@Test public void toHex_bytearray_good() { String hex = ByteArrayUtil.toHex(BYTEARRAY_GOOD); assertThat(hex).isEqualTo(HEXSTRING_GOOD); }
public static String toHex(byte[] byteArray) { if (byteArray == null) { return ""; } StringBuilder hexStringBuilder = new StringBuilder(); for (int i = 0; i < byteArray.length; i++) { hexStringBuilder.append(byteToHex[byteArray[i] & 0xFF]); } return hexStringBuilder.toString(); }
ByteArrayUtil { public static String toHex(byte[] byteArray) { if (byteArray == null) { return ""; } StringBuilder hexStringBuilder = new StringBuilder(); for (int i = 0; i < byteArray.length; i++) { hexStringBuilder.append(byteToHex[byteArray[i] & 0xFF]); } return hexStringBuilder.toString(); } }
ByteArrayUtil { public static String toHex(byte[] byteArray) { if (byteArray == null) { return ""; } StringBuilder hexStringBuilder = new StringBuilder(); for (int i = 0; i < byteArray.length; i++) { hexStringBuilder.append(byteToHex[byteArray[i] & 0xFF]); } return hexStringBuilder.toString(); } private  ByteArrayUtil(); }
ByteArrayUtil { public static String toHex(byte[] byteArray) { if (byteArray == null) { return ""; } StringBuilder hexStringBuilder = new StringBuilder(); for (int i = 0; i < byteArray.length; i++) { hexStringBuilder.append(byteToHex[byteArray[i] & 0xFF]); } return hexStringBuilder.toString(); } private  ByteArrayUtil(); static byte[] fromHex(String hex); static String toHex(byte[] byteArray); static int twoBytesToInt(byte[] bytes, int offset); static int twoBytesSignedToInt(byte[] bytes, int offset); static int threeBytesToInt(byte[] bytes, int offset); static int threeBytesSignedToInt(byte[] bytes, int offset); static int fourBytesToInt(byte[] bytes, int offset); }
ByteArrayUtil { public static String toHex(byte[] byteArray) { if (byteArray == null) { return ""; } StringBuilder hexStringBuilder = new StringBuilder(); for (int i = 0; i < byteArray.length; i++) { hexStringBuilder.append(byteToHex[byteArray[i] & 0xFF]); } return hexStringBuilder.toString(); } private  ByteArrayUtil(); static byte[] fromHex(String hex); static String toHex(byte[] byteArray); static int twoBytesToInt(byte[] bytes, int offset); static int twoBytesSignedToInt(byte[] bytes, int offset); static int threeBytesToInt(byte[] bytes, int offset); static int threeBytesSignedToInt(byte[] bytes, int offset); static int fourBytesToInt(byte[] bytes, int offset);  }