### Question:
ByteUtils { public static byte[] parseHexBinary( String hex ) { final int len = hex.length(); if( len%2 != 0 ) { throw new IllegalArgumentException("hexBinary needs to be even-length: "+hex); } byte[] out = new byte[len/2]; for( int i = 0; i < len; i+=2 ) { int h = hexToBin(hex.charAt(i)); int l = hexToBin(hex.charAt(i+1)); if ( h==-1 || l==-1 ) { throw new IllegalArgumentException("contains illegal character for hexBinary: "+hex); } out[i/2] = (byte)(h*16+l); } return out; } private  ByteUtils(); static String bytes2hex( byte[] bytes ); static String byte2hex( byte b ); static byte[] parseHexBinary( String hex ); static int hexToBin( char c );  }### Answer:
@Test public void testConvertHexToBytes() { byte[] reconstructedBytes = ByteUtils.parseHexBinary(EXPECTED_HEX_STRING); Assertions.assertEquals(bytes.length,reconstructedBytes.length); Assertions.assertTrue(Arrays.equals(bytes,reconstructedBytes)); }