Cara mendapatkan panjang bilangan bulat di java
int length = (int) (Math.log10(number) + 1);
Frightened Frog
int length = (int) (Math.log10(number) + 1);
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int length = String.valueOf(n).length();
System.out.print(length);
int length = 0;
long temp = 1;
while (temp <= number) {
length++;
temp *= 10;
}
return length;