Check out example codes for "len of number in java". It will help you in understanding the concepts better.

Code Example 1

Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		
		int length = String.valueOf(n).length();
		System.out.print(length);

Code Example 2

int length = (int) (Math.log10(number) + 1);

Code Example 3

int length = 0;
long temp = 1;
while (temp <= number) {
    length++;
    temp *= 10;
}
return length;

Learn ReactJs, React Native from akashmittal.com