List of utility methods to do Hex Calculate
String | toHex(int color) to Hex String rv = Integer.toHexString(color); if (color <= 0x0F) return "0" + rv; else return rv; |
char | toHex(int decimalDigit) to Hex return decimalDigit < 10 ? (char) (decimalDigit + '0') : (char) (decimalDigit - 10 + 'A'); |
String | toHex(int h, int minDigit) to Hex char[] digits = new char[8]; int d = 7; do { digits[d--] = hexDigits[h & 0xf]; h >>>= 4; --minDigit; } while (h != 0 || minDigit > 0); return new String(digits, d + 1, 7 - d); ... |
char | toHex(int i) Translates an int into a hex char. if (i >= 0 && i <= 9) return (char) ('0' + i); if (i >= 10 && i <= 15) return (char) ('a' + i - 10); throw new IllegalArgumentException("bad hex digit selector " + i); |
String | toHex(int i) to Hex return "0x" + Integer.toHexString(i); |
String | toHex(int i) Convert an integer to a hex string. String str = Integer.toHexString(0xFF & i); if (str.length() < 2) { str = "0" + str; return str; |
String | toHex(int i, String $default) to Hex return i != -1 ? Integer.toHexString(i) : $default; |
char | toHex(int myByte) to Hex return HEX_DIGITS.charAt(myByte & 0xF);
|
char | toHex(int n) to Hex if ((0 <= n) && (n <= 9)) { return (char) ('0' + n); } else if ((10 <= n) && (n <= 15)) { return (char) (A + n); } else { throw new IllegalArgumentException("" + n); |
String | toHex(int n) to Hex StringBuilder sb = new StringBuilder(); if (n / 16 == 0) { return toHexUtil(n); } else { String t = toHex(n / 16); int nn = n % 16; sb.append(t).append(toHexUtil(nn)); return sb.toString(); |