List of utility methods to do Integer to Hex
String | intToHex(int i) Convert an int to a hex representation. return Integer.toHexString(i);
|
String | intToHex(int i) int To Hex return String.format("0x%08X", i); |
String | IntToHex(int i, int length) Int To Hex String temp = Integer.toHexString(i); while (temp.length() < length * 2) { temp = "0" + temp; return temp; |
String | intToHex(int id) int To Hex if (id < 0x10) { return "0" + Integer.toHexString(id); } else { return Integer.toHexString(id); |
String | intToHex(int num) Int to hex. char[] chars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; int i1 = num / 16; int i2 = num % 16; StringBuffer ret = new StringBuffer(); ret.append(chars[i1]); ret.append(chars[i2]); return ret.toString(); |
String | intToHex(int val) Converts an int to a hex String. String hex = Integer.toHexString(val); if (hex.length() >= 8) { return hex.substring(hex.length() - 8); return String.format("%8s", hex).replace(' ', '0'); |
String | intToHex(int val, char delim) int To Hex byte[] bytes = new byte[4]; for (int i = 3; i >= 0; i -= 1) { bytes[3 - i] = (byte) ((val >>> (i * 8)) & 0xFF); return bytesToHex(bytes, delim); |
StringBuffer | intToHex(int val, StringBuffer sb) int To Hex sb.append(HEX_DIGITS[(val >> 28) & 0xf]); sb.append(HEX_DIGITS[(val >> 24) & 0xf]); sb.append(HEX_DIGITS[(val >> 20) & 0xf]); sb.append(HEX_DIGITS[(val >> 16) & 0xf]); sb.append(HEX_DIGITS[(val >> 12) & 0xf]); sb.append(HEX_DIGITS[(val >> 8) & 0xf]); sb.append(HEX_DIGITS[(val >> 4) & 0xf]); sb.append(HEX_DIGITS[val & 0xf]); ... |
String | intTohex2(int value) int Tohex char hex2[] = { Character.forDigit((value >> 4) & 0x0F, 16), Character.forDigit(value & 0x0F, 16) }; String hex2Str = new String(hex2); return hex2Str.toUpperCase(); |
String | intToHex8(int value) int To Hex return String.format("%08X", value); |