private static int parseNumber(String s, int offset, int radix) {
        int sum = 0;
        int i = offset;
        for (; i < s.length(); i++) {
            final int digit = Character.digit(s.charAt(i), radix);
            if (digit < 0) { // '}' encountered
                break;
            }
            sum = sum * radix + digit;
            if (sum > Character.MAX_CODE_POINT) {
                return -1;
            }
        }
        if (i - offset <= 0) return -1; // no digits found
        return sum;
    }
private static int parseNumber(String s, int offset, int radix)