HexUtils { public static String bytesToHex(byte[] bytes, @Nullable CharSequence delimiter) { return bytesToHexInt(bytes, delimiter != null ? delimiter : ""); } private  HexUtils(); static String bytesToHex(byte[] bytes, @Nullable CharSequence delimiter); static String bytesToHex(byte[] bytes); static byte[] byteToHex(final byte value); static byte[] hexToBytes(String hexString, String delimiter); static byte[] hexToBytes(String hexString); static byte hexToByte(byte high, byte low);  }
@Test public void testBytesToHexNoParams() { byte[] bytes = "ABCD".getBytes(); String result = HexUtils.bytesToHex(bytes); assertEquals("41424344", result); }
@Test public void testBytesToHexWithDelimiter() { byte[] bytes = "ABCD".getBytes(); String result = HexUtils.bytesToHex(bytes, " "); assertEquals("41 42 43 44", result); }
@Test public void testBytesToHexWithMultiCharDelimiter() { byte[] bytes = "ABCD".getBytes(); String result = HexUtils.bytesToHex(bytes, "-:-"); assertEquals("41-:-42-:-43-:-44", result); }