List of utility methods to do Integer to Hex
byte[] | intToHexBytes(int i) int To Hex Bytes byte[] bytes = new byte[8]; oneByteToHexBytes((byte) ((i >>> 24) & 0xff), bytes, 0); oneByteToHexBytes((byte) ((i >>> 16) & 0xff), bytes, 2); oneByteToHexBytes((byte) ((i >>> 8) & 0xff), bytes, 4); oneByteToHexBytes((byte) (i & 0xff), bytes, 6); return bytes; |
char | intToHexChar(int i) int To Hex Char if (i < 0) { return '?'; } else if (i < 10) { return (char) ('0' + i); } else if (i < 16) { return (char) ('a' + i - 10); } else { return '?'; ... |
char[] | intToHexChars(int n) Returns a string of 8 hexadecimal digits (most significant digit first) corresponding to the integer n, which is treated as unsigned. char[] buf = new char[8]; for (int i = 7; i >= 0; i--) { buf[i] = HEX_DIGITS[n & 0x0F]; n >>>= 4; return buf; |
String | intToHexLE(int val) Converts an int to a little-endian hex String. StringBuilder buf = new StringBuilder(); for (int i = 0; i < 32; i += 8) { String hex = Integer.toHexString((0xff & (val >> i))); if (hex.length() == 1) { buf.append('0'); buf.append(hex); return buf.toString(); |
String | intToHexStr(int i, int len) int To Hex Str String h = Integer.toHexString(i); boolean needFill = h.length() % 2 != 0; int l = needFill ? (h.length() / 2 + 1) : (h.length() / 2); if (needFill) h = "0" + h; StringBuffer buffer = new StringBuffer(); for (int j = 0; j < (len - l); j++) { buffer.append("00"); ... |
String | intToHexStr(int src, int len, int code) int To Hex Str return longToHexStr(src, len, code);
|
String | IntToHexString(final int value) Int To Hex String final String string = Integer.toString(value, 16).toUpperCase(); if (string.charAt(0) == '-') { return "-0X" + string.substring(1, string.length()); } else { return "0X" + string; |
String | intToHexString(int _i) Wandelt einen Integer in einen Hex-String um return Integer.toHexString(_i).toUpperCase();
|
String | intToHexString(int i) int To Hex String StringBuilder sb = new StringBuilder(10); while (i > 0) { int rest = i % 16; sb.append(HEXES.charAt(rest)); i /= 16; sb.reverse(); return sb.toString(); ... |
String | intToHexString(int i) int To Hex String return intToHexString(i, 8);
|