public static int hexCharToInt(char c) {
        if (c >= '0' && c <= '9') {
            return (c - '0');
        }
        if (c >= 'A' && c <= 'F') {
            return (c - 'A' + 10);
        }
        if (c >= 'a' && c <= 'f') {
            return (c - 'a' + 10);
        }

        throw new RuntimeException("invalid hex char '" + c + "'");
    }
Converts a hex String to a byte array.

@param s
           A string of hexadecimal characters, must be an even number of
           chars long

@return byte array representation

@throws RuntimeException
            on invalid format
replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/basic/ByteConvertor.java