### Question:
Util { public static byte[] hexStringToByteArray(String s) { if ((s.length() % 2) != 0) { s = "0" + s; } int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16)); } return data; }  static String byteToHexString(byte b); static byte[] hexStringToByteArray(String s); static String byteArrayToHexString(byte[] raw, boolean spaces); static String hexStringToBinaryString(String s); static String intToHexString(int i); static int hexStringToInt(String s);  }### Answer:
@Test public void testHexStringToByteArray() { System.out.println("hexStringToByteArray"); String s = "FF124A"; byte[] expResult = new byte[] {(byte)0xFF, (byte)0x12, (byte)0x4A}; byte[] result = Util.hexStringToByteArray(s); assertEquals(expResult.length, 3); assertEquals(expResult[0], result[0]); assertEquals(expResult[1], result[1]); assertEquals(expResult[2], result[2]); }