Java Utililty Methods Hex to Byte

List of utility methods to do Hex to Byte

Description

The list of methods to do Hex to Byte are organized into topic(s).

Method

byteconvertHexCharacterToHalfByte(char character)
convert Hex Character To Half Byte
if ((character >= '0') && (character <= '9')) {
    return (byte) (character - '0');
} else if ((character >= 'a') && (character <= 'f')) {
    return (byte) (character - 'a' + 10);
} else if ((character >= 'A') && (character <= 'F')) {
    return (byte) (character - 'A' + 10);
} else {
    throw new IllegalArgumentException("'" + character + "' is an illegal character in HEX code!");
...
byteconvertHexDigit(byte b)
convert Hex Digit
if ((b >= '0') && (b <= '9'))
    return (byte) (b - '0');
if ((b >= 'a') && (b <= 'f'))
    return (byte) (b - 'a' + 10);
if ((b >= 'A') && (b <= 'F'))
    return (byte) (b - 'A' + 10);
throw new IllegalArgumentException("!hex:" + Integer.toHexString(0xff & b));
byteconvertHexDigit(byte b)
convert Hex Digit
if ((b >= '0') && (b <= '9')) {
    return (byte) (b - '0');
if ((b >= 'a') && (b <= 'f')) {
    return (byte) (b - 'a' + 10);
if ((b >= 'A') && (b <= 'F')) {
    return (byte) (b - 'A' + 10);
...
byteconvertHexDigit(byte b)
Convert a byte character value to hexadecimal digit value.
if ((b >= '0') && (b <= '9'))
    return (byte) (b - '0');
if ((b >= 'a') && (b <= 'f'))
    return (byte) (b - 'a' + 10);
if ((b >= 'A') && (b <= 'F'))
    return (byte) (b - 'A' + 10);
throw new IllegalArgumentException("requestUtil.convertHexDigit.notHex" + Character.valueOf((char) b));
byteconvertHexDigit(byte b)
convert Hex Digit
if ((b >= '0') && (b <= '9'))
    return (byte) (b - '0');
if ((b >= 'a') && (b <= 'f'))
    return (byte) (b - 'a' + 10);
if ((b >= 'A') && (b <= 'F'))
    return (byte) (b - 'A' + 10);
return 0;
byteconvertHexDigit(byte c)
convert Hex Digit
byte b = (byte) ((c & 0x1f) + ((c >> 6) * 0x19) - 0x10);
if (b < 0 || b > 15)
    throw new NumberFormatException("!hex " + c);
return b;