List of utility methods to do Byte Array Print
String | printByteArrayToHex(byte[] byteArray, int length) print Byte Array To Hex StringBuffer buffer = new StringBuffer(); for (int z = 0; z < length; z++) { buffer.append(Integer.toHexString(byteArray[z])); return buffer.toString(); |
String | printByteHexEncoded(byte b) print Byte Hex Encoded return String.format("0x%02x", b & 0xff); |
void | printBytes(byte[] ba) print Bytes printBytes(ba, false); |
String | printBytes(byte[] buffer, int start, int length) print Bytes StringBuilder sb = new StringBuilder(length - start); for (int i = start; i < start + length; i++) { sb.append(String.format("%%%02x", buffer[i])); return sb.toString(); |
void | printBytes(byte[] bytes) print Bytes StringBuilder sb = new StringBuilder(); for (byte b : bytes) { String byteString = Integer.toHexString(b & 0x000000FF); byteString = byteString.length() == 1 ? "0" + byteString : byteString; sb.append(byteString); System.out.println(sb.toString()); |
String | printBytes(byte[] bytes) print Bytes return printBytes(bytes, 0, bytes.length);
|
void | printBytes(byte[] bytes) print Bytes printBytes(bytes, 0, bytes.length); |
void | printBytes(byte[] bytes) print Bytes if (bytes == null || bytes.length <= 0) { System.out.println("Empty byte array."); return; StringBuilder sb = new StringBuilder(); sb.append("Total length:"); sb.append(bytes.length); sb.append(",["); ... |
void | printBytes(byte[] bytes, int offset) print Bytes for (int i = offset; i < bytes.length; i++) { System.out.print("(" + i + "):" + bytes[i]); System.out.println(); |
String | printBytes(byte[] data) print Bytes StringBuffer sb = new StringBuffer(); sb.append("["); for (int i = 0; i < data.length; i++) { String hex = Integer.toHexString(data[i]); if (hex.length() == 1) hex = "0" + hex; else hex = hex.substring(hex.length() - 2); ... |