public final class Hexadecimal
extends java.lang.Object
The class is composed of static methods, and, unfortunately, a static buffer. Thus it is not thread-safe.
| Constructor and Description |
|---|
Hexadecimal() |
| Modifier and Type | Method and Description |
|---|---|
static void |
printHexByte(byte b)
Print a single byte as a hex pair to System-out.
|
static void |
printHexLine(byte[] buf,
int address,
int count)
Dump one line of memory as hex dump.
|
static void |
printHexRange(byte[] buf,
int addressBegin,
int addressEnd)
Dump a range of memory in hex dump format.
|
static void |
printHexWord(int word)
Print a single word as a hex quad to System-out.
|
public static void printHexRange(byte[] buf,
int addressBegin,
int addressEnd)
Note that addressBegin will appear flush left, instead of being properly aligned to a 16-byte boundary. It would be a good enhancement, I think, to start printing at the correct column position. For example, dumping from address 0x0003 will currently print:
0003: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........whereas it should print:
0003: 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
buf - The byte array to interpret data from.addressBegin - The starting address in buf to dump data from.addressEnd - The ending address.public static void printHexLine(byte[] buf,
int address,
int count)
This will dump the 16 bytes or less given in the following format:
aaaa: hh hh hh hh hh hh hh hh hh hh hh hh hh hh hh hh ........ ........
public static void printHexByte(byte b)
b - The byte to print.public static void printHexWord(int word)
word - The 2-byte value to print.Copyright ? 2002 Clarity Systems Group, LLC. All Rights Reserved.