List of utility methods to do Hex String Print
String | printHex(byte[] array, int offset, int len) Get a hexadecimal representation of a byte array starting at offset index for len bytes, with each octet separated by a space.
StringBuilder sb = new StringBuilder(); for (int i = 0; i < len; i++) { byte b = array[offset + i]; if (sb.length() > 0) sb.append(' '); sb.append(digits[b >> 4 & 0x0F]); sb.append(digits[b & 0x0F]); return sb.toString(); |
StringBuffer | toFormattedHexString(StringBuffer text, byte[] data) to Formatted Hex String if (data != null) for (int index = 0; index < data.length; index++) { if (index > 0) if (index % 8 == 0) if (index % 32 == 0) text.append(sSep); else text.append(" "); ... |
String | toFormattedHexString(byte[] data) to Formatted Hex String return data == null ? "" : toFormattedHexString( new StringBuffer(data.length << 2), data).toString(); |