### Question:
HexUtils { public static String byteArrayToHexString(final byte[] b) { StringBuilder sb = new StringBuilder(); String returnStr = ""; for (int i = 0; i < b.length; i++) { String singleByte = Integer.toHexString(b[i] & FF_BYTE); if (singleByte.length() != 2) { singleByte = "0" + singleByte; } returnStr = sb.append(singleByte).toString(); } return returnStr; } private  HexUtils(); static byte[] hexStringToByteArray(final String s); static String byteArrayToHexString(final byte[] b); static Integer hexToInt(final String s); static byte[] subarray(final byte[] b, final int start, final int end); static byte[] leReverseByte(final byte[] in); static int leReverseInt(final byte[] in); static long bytesToLong(final byte[] bytes); static final int HEX_BASIS; static final int FF_BYTE; }### Answer:
@Test public void testByteArrayToHexString() { String target = "abcd1234"; byte[] b = {-85, -51, 18, 52}; String s = HexUtils.byteArrayToHexString(b); Assert.assertEquals(s, target); }
@Test public void testByteArrayToHexStringConditional() { String target = "abcd0100"; byte[] b = {-85, -51, 1, 0}; String s = HexUtils.byteArrayToHexString(b); Assert.assertEquals(s, target); }