BeaconContentUtil { static String printHexBinary(final byte[] deviceMessage) { if (deviceMessage == null) { return null; } final StringBuilder sb = new StringBuilder(deviceMessage.length * 2); for (byte byteValue : deviceMessage) { final int intValue = Byte.toUnsignedInt(byteValue); sb.append(HEX_CODE[intValue >>> 4]); sb.append(HEX_CODE[intValue & 0xf]); } return sb.toString(); } private  BeaconContentUtil();   }
@Test public void printHexBinaryForActualValue() throws Exception { String result = BeaconContentUtil.printHexBinary(new byte[] { 0x01, (byte) 0xab }); assertThat(result).isEqualTo("01ab"); }
@Test public void printHexBinaryForNull() throws Exception { String result = BeaconContentUtil.printHexBinary(null); assertThat(result).isNull(); }
@Test public void printHexBinaryForEmpty() throws Exception { String result = BeaconContentUtil.printHexBinary(new byte[] {}); assertThat(result).isNotNull().isEmpty(); }