private int numDigits(int n){
  return (int)Math.log10(n) + 1;
}

private int numDigits ( int n ) { return ( int ) Math . log10 ( n ) + 1 ; }
returns the number of digits in the printed representation of the argument .
