answersLogoWhite

0

Implement this method in Java:

public static int[] countNums(int n) {

int x = n;

int[] nums = new int[10];

while(x != 0) {

nums[x % 10]++;

x /= 10;

}

return nums;

}

That will return an array of the counts of the digits from 0 to 9.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

How high can you count with a six decimal digit?

Up to 999999, one short of a million.


What is the biggest four-digit number for 850236?

The biggest 4 digit number that can be made from using the digits of 850236, using a digit at most once, is 8653.


How many combinations of 2 and 3 digit number using 4 and 8?

the answer is = first 2-digit number by using 48= 28,82 and in 3 digit is=282,228,822,822


How do you multiply a 4 digit number by a 2 digit number?

Using a calculator will make it easier


What is the number that you can count up to using 10 bits?

the highest number you can count up to using 10 bits is 1029 using binary


Which is the greatest 4 digit number using 3 different digit?

1324


What is the smallest 4 digit number using only one digit?

1111


How many 3 digit number can you form from digit number using 4 5 7 without repeating any digit?

Six of them.


How many two digit number combinations can you get using the number 1234 without repeating a digit?

There are twelve possible solutions using the rule you stated.


What is the greatest seven-digit number using four different digits?

9,999,876 is the greatest seven-digit number using four different digits.


What is smallest four digit number not using zero?

The smallest four-digit number not using zero is 1000. In a four-digit number, the first digit cannot be zero, so the smallest possible value for the first digit is 1. The remaining three digits can be any number from 0-9, so the smallest possible four-digit number is 1000.


How does the place of each digit help the value of the number?

the place of each digit help the value of the number by using your multuplication