### Question:
HexString { public static byte[] decodeHexString( String hexString ) { int len = hexString.length(); byte[] data = new byte[len / 2]; for ( int i = 0, j = 0; i < len; i += 2, j++ ) { int highByte = Character.digit( hexString.charAt( i ), 16 ) << 4; int lowByte = Character.digit( hexString.charAt( i + 1 ), 16 ); if ( highByte < 0 || lowByte < 0 ) { return null; } data[j] = (byte) ( highByte + lowByte ); } return data; } private  HexString(); static String encodeHexString( byte[] bytes ); static byte[] decodeHexString( String hexString );  }### Answer:
@Test void shouldDecodeStringToBytes() { byte[] result = HexString.decodeHexString( "00f34CEFFF3e02" ); byte[] expected = new byte[] {(byte) 0x00, (byte) 0xF3, (byte) 0x4C, (byte) 0xEF, (byte) 0xFF, (byte) 0x3E, (byte) 0x02 }; assertArrayEquals( expected, result ); }
@Test void shouldDecodeEmptyStringToEmptyBytes() { byte[] result = HexString.decodeHexString( "" ); assertArrayEquals( new byte[]{}, result ); }