public static int stringSize(int x) {
        for (int i = 0;; i++) {
            if (x <= sizeTable[i]) {
                return i + 1;
            }
        }
    }
All possible chars for representing a number as a String
src/main/java/com/alibaba/fastjson/util/IOUtils.java