A simpler method
int a= 123456
String sa = ""+a; //Convert a number into a string
int alen = sa . length(); Obtained length
The length of Alen is.
can use
int length = 0;
int b = 1;
fo(int n = 1; n & lt300; n++){
b = b * 10;
If (a/b==0){
Length = I;;
Break; }
}
Length will also get the length.