List of utility methods to do Hex Calculate
String | toHex(byte b) to Hex String st = Integer.toHexString(b); return (st.length() == 1) ? "0" + st : st; |
String | toHex(byte b) Renders a given by to nice human readable hex format. StringBuffer sb = new StringBuffer(4); sb.append("0x"); int val = b & 0xff; if (val < 0x10) sb.append("0"); sb.append(Integer.toString(val, 16)); return sb.toString(); |
String | toHex(byte b) convert to hex string return toHex(((long) b) & 0xFFL); |
String | toHex(byte b) Convert a byte to its hexadecimal representation. return (new Character(hexDigits[(b & 0xF0) >> 4])).toString() + hexDigits[b & 0x0F]; |
void | toHex(byte b, char[] charArray, int from) Converts a byte value to hexadecimal and put the result in an array. charArray[from] = c[(b >> 4) & 0x0F]; charArray[from + 1] = c[b & 0x0F]; |
String | toHex(byte b, String prefix) to Hex return prefix + String.format("%02x", b); |
String | toHex(byte bytes[]) to Hex StringBuffer buf = new StringBuffer(bytes.length * 2); int i; for (i = 0; i < bytes.length; i++) { if ((bytes[i] & 0xff) < 0x10) { buf.append("0"); buf.append(Long.toString(bytes[i] & 0xff, 16)); return buf.toString(); |
String | toHex(byte data[]) to Hex char[] hex = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', }; StringBuffer result = new StringBuffer(data.length * 2); for (int i = 0; i < data.length; i++) { result.append(hex[(data[i] >> 4) & 0x0f]).append(hex[data[i] & 0x0f]); return result.toString(); |
String | toHex(byte hash[]) to Hex if (hash == null) { return null; StringBuffer buf = new StringBuffer(hash.length * 2); int i; for (i = 0; i < hash.length; i++) { if ((hash[i] & 0xff) < 0x10) { buf.append("0"); ... |
byte | toHex(byte in) to Hex if (in >= '0' && in <= '9') { return (byte) (in - '0'); } else if (in >= 'A' && in <= 'F') { return (byte) (in - 'A'); } else if (in >= 'a' && in <= 'f') { return (byte) (in - 'a'); return in; ... |