Question: JAVA Write a method called calcDigitInfo that takes as argument an int and returns an array containing two values: the number of digits in the

JAVA Write a method called calcDigitInfo that takes as argument an int and returns an array containing two values: the number of digits in the input integer and the sum of the digits in the input integer.

For example, calcDigitInfo(12345) would return an array containing {5, 15} because there are 5 digits and 1 + 2 + 3 + 4 + 5 = 15.

The input integer can be positive, negative, or 0. calcDigitInfo(0) would return an array containing {1, 0} because 0 is a digit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!