public static byte[] hexStringToByte(String hexString)
    {
        if ((hexString.length() & 1) == 1)  // nibbles promote to a full byte
            hexString = '0' + hexString;
        byte[] tmp = new byte[hexString.length() / 2];
        for (int i = 0; i < tmp.length; ++i) {
            String hexByte = hexString.substring(i * 2, i * 2 + 2);
            tmp[i] = (byte) Integer.parseInt(hexByte, 16);
        }

        return tmp;
    }
Converts a hex String to byte[]. Will convert full bytes only, odd number of hex characters will
have a leading '0' added. Big endian.

@param hexString an hex string (ie. "0fdA1").
@return the byte[] value of the hex string
plugins/org.jkiss.dbeaver.ui.editors.hex/src/org/jkiss/dbeaver/ui/editors/binary/HexEditControl.java