List of utility methods to do Hex Print
String | printHexNumber(int n) Returns number in 0xABCDEF-Format return "0x" + Integer.toHexString(n).toUpperCase(); |
String | printHexString(byte[] b) print Hex String String str = ""; for (int i = 0; i < b.length; i++) { String hex = Integer.toHexString(b[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; str += hex.toUpperCase(); return str; |
void | printHexString(final StringBuilder sb, final String hexData) Formats hex dta into 64 byte rows. int rem = hexData.length(); int curs = 0; while (rem >= 64) { sb.append(String.format("%8d: ", curs)); sb.append(hexData.substring(curs, curs + 64) + "\n"); curs += 64; rem -= 64; |