List of utility methods to do Hex Calculate
int | toHexDigit(char ch, int index) to Hex Digit int digit = Character.digit(ch, 16); if (digit == -1) { throw new RuntimeException("Illegal hexadecimal charcter " + ch + " at index " + index); return digit; |
char | toHexDigit(int d) to Hex Digit return (char) (d < 0xA ? d + '0' : d - 0xA + 'A'); |
char | toHexDigit(int d) to Hex Digit switch (d) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: ... |
char | toHexDigit(int h) to Hex Digit char out; if (h <= 9) out = (char) (h + 0x30); else out = (char) (h + 0x37); return out; |
char | toHexDigit(int i) Return the correct hex character for this integer value. return "0123456789abcdef".charAt(i); |
char | toHexDigit(int number) Return the single digit character representing the HEX encoding of the lower four bits of a given integer. switch (number & 0x0F) { case 0x00: return '0'; case 0x01: return '1'; case 0x02: return '2'; case 0x03: ... |
String | toHexDigit(int value, int digitPosition) Converts a base-ten integer to a hexadecimal value at a particular digit. int digitValue = (value >>> (digitPosition * 4)) & 0xf; return Integer.toHexString(digitValue); |
String | toHexDigits(byte[] bytes) to Hex Digits StringBuffer encoded = new StringBuffer(bytes.length * 2); for (int eachByte = 0; eachByte < bytes.length; eachByte++) { encoded.append(toHexDigits(bytes[eachByte]).toUpperCase()); return encoded.toString(); |
String | toHexDigits(int value) to Hex Digits return String.format("%02x", value); |
String | toHexDump(byte[] ab, int cBytesPerLine) Convert a byte array to a hex dump. int cb = ab.length; if (cb == 0) { return ""; int cDigits = 0; int cbTemp = cb - 1; do { cDigits += 2; ... |