public static int intLogBase10 ( long value ) { return ( value >= 1000000000000000000L ) ? 18 : ( ( value >= 100000000000000000L ) ? 17 : ( ( value >= 10000000000000000L ) ? 16 : ( ( value >= 1000000000000000L ) ? 15 : ( ( value >= 100000000000000L ) ? 14 : ( ( value >= 10000000000000L ) ? 13 : ( ( value >= 1000000000000L ) ? 12 : ( ( value >= 100000000000L ) ? 11 : ( ( value >= 10000000000L ) ? 10 : ( ( value >= 1000000000L ) ? 9 : ( ( value >= 100000000L ) ? 8 : ( ( value >= 10000000L ) ? 7 : ( ( value >= 1000000L ) ? 6 : ( ( value >= 100000L ) ? 5 : ( ( value >= 10000L ) ? 4 : ( ( value >= 1000L ) ? 3 : ( ( value >= 100L ) ? 2 : ( ( value >= 10L ) ? 1 : 0 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ; }
Calcalates the log base 10 of an integer . This method favours shorter numbers .