Originally posted by Stan James:
This is probably sloppy, but I concatenate an empty string with a number to make it a string now and then
That is actually the easiest way. You could also use the static toString(int i) method of Integer:
int digits = Integer.toString(i).length();