private static int toByte(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 InvalidParameterException("Invalid hex char '" + c + "'");
    }
Clone of Android's /core/java/com/android/internal/util/HexDump class, for use in debugging.
Changes: space separated hex strings
usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/util/HexDump.java