@Test public void testNiceNiblesOutput_1(){ byte[] test = {7, 0, 7, 5, 7, 0, 7, 0, 7, 9}; String result = "\\x07\\x00\\x07\\x05\\x07\\x00\\x07\\x00\\x07\\x09"; assertEquals(result, ByteUtil.nibblesToPrettyString(test)); }
public static String nibblesToPrettyString(byte[] nibbles){ StringBuffer buffer = new StringBuffer(); for (byte nibble : nibbles) { String nibleString = oneByteToHexString(nibble); buffer.append("\\x" + nibleString); } return buffer.toString(); }
ByteUtil { public static String nibblesToPrettyString(byte[] nibbles){ StringBuffer buffer = new StringBuffer(); for (byte nibble : nibbles) { String nibleString = oneByteToHexString(nibble); buffer.append("\\x" + nibleString); } return buffer.toString(); } }
ByteUtil { public static String nibblesToPrettyString(byte[] nibbles){ StringBuffer buffer = new StringBuffer(); for (byte nibble : nibbles) { String nibleString = oneByteToHexString(nibble); buffer.append("\\x" + nibleString); } return buffer.toString(); }  }
ByteUtil { public static String nibblesToPrettyString(byte[] nibbles){ StringBuffer buffer = new StringBuffer(); for (byte nibble : nibbles) { String nibleString = oneByteToHexString(nibble); buffer.append("\\x" + nibleString); } return buffer.toString(); }  static byte[] appendByte(byte[] bytes, byte b); static byte[] bigIntegerToBytes(BigInteger b, int numBytes); static byte[] bigIntegerToBytes(BigInteger value); static int matchingNibbleLength(byte[] a, byte[] b); static byte[] longToBytes(long val); static String toHexString(byte[] data); static byte[] calcPacketLength(byte[] msg); static int byteArrayToInt(byte[] b); static String nibblesToPrettyString(byte[] nibbles); static String oneByteToHexString(byte value); static int numBytes(String val); static byte[] encodeValFor32Bits(Object arg); static byte[] encodeDataList(Object... args); static byte[] stripLeadingZeroes(byte[] data); static boolean increment(byte[] bytes); static byte[] copyToArray(BigInteger value); }
ByteUtil { public static String nibblesToPrettyString(byte[] nibbles){ StringBuffer buffer = new StringBuffer(); for (byte nibble : nibbles) { String nibleString = oneByteToHexString(nibble); buffer.append("\\x" + nibleString); } return buffer.toString(); }  static byte[] appendByte(byte[] bytes, byte b); static byte[] bigIntegerToBytes(BigInteger b, int numBytes); static byte[] bigIntegerToBytes(BigInteger value); static int matchingNibbleLength(byte[] a, byte[] b); static byte[] longToBytes(long val); static String toHexString(byte[] data); static byte[] calcPacketLength(byte[] msg); static int byteArrayToInt(byte[] b); static String nibblesToPrettyString(byte[] nibbles); static String oneByteToHexString(byte value); static int numBytes(String val); static byte[] encodeValFor32Bits(Object arg); static byte[] encodeDataList(Object... args); static byte[] stripLeadingZeroes(byte[] data); static boolean increment(byte[] bytes); static byte[] copyToArray(BigInteger value); static final byte[] EMPTY_BYTE_ARRAY; }