List of utility methods to do Hex String Create
int | toHex(int address) to Hex return address - 0xC00000 + 0x200;
|
byte[] | toHexByte(String str, int offset, int length) to Hex Byte byte[] data = new byte[(length - offset) * 2]; int end = offset + length; int high_nibble; int low_nibble; for (int i = offset; i < end; i++) { char ch = str.charAt(i); high_nibble = (ch & 0xF0) >>> 4; low_nibble = ch & 0x0F; ... |
char | toHexChar(int i) Convenience method to convert an int to a hex char. if ((0 <= i) && (i <= 9)) { return (char) ('0' + i); } else { return (char) ('a' + (i - 10)); |
String | toHexDigits(byte theByte) Private replacement for toHexString since we need the leading 0 digits. final char[] HEXDIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; StringBuilder result = new StringBuilder(2); result.append(HEXDIGITS[(theByte >>> 4) & 15]); result.append(HEXDIGITS[theByte & 15]); return result.toString(); |
String | toHexDigits(byte[] bytes) to Hex Digits StringBuilder encoded = new StringBuilder(bytes.length * 2); for (byte aByte : bytes) { encoded.append(toHexDigits(aByte).toUpperCase()); return encoded.toString(); |
String | toHexString(byte oneByte) to Hex String return String.format("%02x", oneByte); |
String | bt64ToHex(int[] byteData) bt To Hex String hex = ""; for (int i = 0; i < 16; i++) { String bt = ""; for (int j = 0; j < 4; j++) { bt += byteData[i * 4 + j]; hex += bt4ToHex(bt); return hex; |