Is there a neater way for getting the number of digits in an int than this method?
int numDigits = String.valueOf(1000).length();
What about this recursive method?
private static int length = 0; public static int length(int n) { length++; if((n / 10) < 10) { length++; } else { length(n / 10); } return length; }