### Question:
Util { public static String byteArrayToHexString(byte[] raw, boolean spaces) { if (raw == null) { return null; } final StringBuilder hex = new StringBuilder(2 * raw.length); for (byte b : raw) { hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt((b & 0x0F))); if(spaces) hex.append( ' ' ); } if(spaces) hex.setLength(hex.length()-1); return hex.toString(); }  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 testByteArrayToHexString() { System.out.println("byteArrayToHexString"); byte[] raw = new byte[] {(byte)0xFF, (byte)0x12, (byte)0x4A}; String expResult = "FF124A"; String result = Util.byteArrayToHexString(raw, false); assertEquals(expResult, result); }
@Test public void testByteArrayToHexString2() { System.out.println("byteArrayToHexString2"); byte[] raw = new byte[] {(byte)0xFF, (byte)0x12, (byte)0x4A}; String expResult = "FF 12 4A"; String result = Util.byteArrayToHexString(raw, true); assertEquals(expResult, result); }