Java Utililty Methods Byte Array Dump

List of utility methods to do Byte Array Dump

Description

The list of methods to do Byte Array Dump are organized into topic(s).

Method

voiddump(byte b[])
dump
dump(b, b.length);
voiddump(byte[] array)
dump
dumpTo(array, array.length);
voiddump(byte[] array)
dump
dump(array, 0, array.length);
Stringdump(byte[] buff, int size, boolean asBits)
dump
String s = "";
for (int i = 0; i < size; i++) {
    String ss = null;
    if (!asBits) {
        ss = Integer.toHexString(buff[i] & 0xff);
    } else {
        ss = Integer.toBinaryString(buff[i] & 0xff);
    ss = fillInZeroPrefix(ss, asBits);
    s += " " + ss;
return s;
Stringdump(byte[] buffer)
dump
StringBuilder b = new StringBuilder(buffer.length * 3);
for (int i = 0, num = buffer.length; i < num; ++i) {
    if (i > 0)
        b.append(" ");
    b.append(String.format("%02X", buffer[i]));
return b.toString();
StringBuilderdump(byte[] bytes)
dump byte [] as StringBuilder "0x00, ..., 0xFF"
if (bytes == null)
    throw new IllegalArgumentException("null bytes");
return dump(bytes, 0, bytes.length);
Stringdump(byte[] bytes, int offset, int byteslen)
Dump to string using a debugger-like format - both hex and ascii.
final StringBuffer b = new StringBuffer();
final int width = 32;
int len = width;
while (offset < byteslen) {
    int remainder = 0;
    if (offset + len > byteslen) {
        len = byteslen - offset;
        remainder = width - len;
...
Stringdump(byte[] data, int offset, int length)
dump
StringBuilder sb = new StringBuilder();
sb.append(" byte dump log ");
sb.append(System.lineSeparator());
sb.append(" offset ").append(offset);
sb.append(" length ").append(length);
sb.append(System.lineSeparator());
int lines = (length - 1) / 16 + 1;
for (int i = 0, pos = 0; i < lines; i++, pos += 16) {
...
voiddump(byte[] data, int pos, int length)
Dump a human-readable hex dump of data to standard out.
for (int i = pos; i < length + pos; ++i) {
    System.out.printf("%X ", data[i]);
System.out.println("");
voiddump(byte[] mem, int start, int len)
dump
int i, j;
StringBuffer string = new StringBuffer(50);
StringBuffer chars = new StringBuffer(18);
String vis = new String(mem, start, len);
i = j = 0;
while (i < len) {
    int b = ((int) mem[i + start]);
    if (b < 0)
...