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