SteveNewson
2/28/2013 - 4:09 PM

Dumps something containing bytes to a nice Hex Dump

Dumps something containing bytes to a nice Hex Dump

for (int x = 0; x < 16; x++)
{
  final StringBuilder stringBuilder = new StringBuilder();
  final StringBuilder hexBuilder = new StringBuilder();
  for (int i = 0; i < 16; i++)
  {
    final byte theByte = [something.readByte];
    hexBuilder.append(String.format("%02x ", theByte));
    stringBuilder.append(theByte < 32 || theByte > 126 ? "." : (char) theByte);
  }
}