public static String toString(byte[] bytes, int base) {
        StringBuilder buf = new StringBuilder();
        for (byte b : bytes) {
            int bi = 0xff & b;
            int c = '0' + (bi / base) % base;
            if (c > '9') {
                c = 'a' + (c - '0' - 10);
            }
            buf.append((char) c);
            c = '0' + bi % base;
            if (c > '9') {
                c = 'a' + (c - '0' - 10);
            }
            buf.append((char) c);
        }
        return buf.toString();
    }
Parse an int from a substring.
Negative numbers are not handled.

@param s      String
@param offset Offset within string
@param length Length of integer or -1 for remainder of string
@param base   base of the integer
@return the parsed integer
@throws NumberFormatException if the string cannot be parsed
src/main/java/spark/utils/urldecoding/TypeUtil.java