private static int hex2int(char c) {
        int nybble;
        if (c >= '0' && c <= '9') {
            nybble = c - '0';
        } else if (c >= 'a' && c <= 'f') {
            nybble = 10 + c - 'a';
        } else if (c >= 'A' && c <= 'F') {
            nybble = 10 + c - 'A';
        } else {
            throw new IllegalArgumentException("Hex value MUST be in range [0-9a-fA-F]");
        }
        return nybble;
    }