To find number of digits in a number in Java, do this:
String.valueOf(number).length()
.Here's how you do it:
int number = 123;
int digits = String.valueOf(number).length();
System.out.println(digits); // 3
String.valueOf(number).length()
.Here's how you do it:
int number = 123;
int digits = String.valueOf(number).length();
System.out.println(digits); // 3