Android Utililty Methods Hex String Print

List of utility methods to do Hex String Print

Description

The list of methods to do Hex String Print are organized into topic(s).

Method

StringprintHex(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();
StringBuffertoFormattedHexString(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("  ");
...
StringtoFormattedHexString(byte[] data)
to Formatted Hex String
return data == null ? "" : toFormattedHexString(
        new StringBuffer(data.length << 2), data).toString();