Utils { public static String toHex(final byte[] data) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < data.length; i++) { int v = Byte.toUnsignedInt(data[i]); buf.append(DIGITS.charAt(v >> MASK_1)); buf.append(DIGITS.charAt(v & MASK_2)); } return buf.toString(); } private  Utils(); static byte[] concatByteArray(final byte[] a, final byte[] b); static int getBitRange(final int b, final int s, final int n); static int mergeBytes(final int high, final int low); static int setBitRange(final int val,
            final int start, final int len, final int newVal); static byte[] splitInteger(final int value); static String toHex(final byte[] data);  }
@Test public void testToHex() { byte[] data = new byte[]{0, 1, -1}; String expResult = "0001ff"; String result = Utils.toHex(data); assertEquals(expResult, result); }