public static final int stringSize(final int x) {
        if (x == Integer.MAX_VALUE) {
            return 10;
        }
        if (x == Integer.MIN_VALUE) {
            return 11;
        }
        if (x >= 0) {
            return stringPositiveSize(x);
        }
        else {
            return 1 + stringPositiveSize(0L - x);
        }
    }
All possible chars for representing a number as a String
metamorphosis-commons/src/main/java/com/taobao/metamorphosis/network/ByteUtils.java