number of digits of all integer code example Example: how to get length of integer in java int length = (int) (Math.log10(number) + 1);