");
int col = 0;
int count = 0;
int rows = (int)Math.ceil((float)data.length / COLS);
echo("");
for(int i = 0; i < rows; i++) {
String offset = Integer.toString(i*COLS);
StringBuilder offsetPadding = new StringBuilder();
while(offset.length() + offsetPadding.length() < OFFSETLEN) {
offsetPadding.append("0");
}
echo("0x" + offsetPadding.toString() + offset + ": | ");
}
echo(" ");
echo(" | | ");
echo("");
for(byte b: data) {
if(col == 0) echo("");
String hex = Integer.toHexString(b&0xFF).toUpperCase();
if(hex.length() != 2) hex = "0" + hex;
echo("" + hex + " | ");
col++;
count++;
if(col >= COLS) {
echo(" ");
col = 0;
}
}
boolean needFinal = false;
while(col < COLS && col != 0) {
echo(" | ");
col++;
needFinal = true;
}
if(needFinal) {
echo("");
needFinal = false;
}
echo(" ");
echo(" | | ");
echo("");
col = 0;
count = 0;
for(byte b: data) {
if(col == 0) echo("");
echo("" + (char)b + " | ");
col++;
count++;
if(col >= COLS) {
echo(" ");
col = 0;
}
}
while(col < COLS && col != 0) {
echo(" | ");
col++;
needFinal = true;
}
if(needFinal) {
echo("");
needFinal = false;
}
echo(" ");
echo(" |