List of utility methods to do Hex Calculate
String | toHexString(byte[] b) Convenience method to print byte array as hexadecimal string. StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) int c = ((b[i]) >>> 4) & 0xf; sb.append(hex[c]); c = ((int) b[i] & 0xf); sb.append(hex[c]); return sb.toString(); |
String | toHexString(byte[] b) Convert bytes to hex string (all lower-case). StringBuilder sb = new StringBuilder(b.length << 2); for (byte x : b) { int hi = (x & 0xf0) >> 4; int lo = x & 0x0f; sb.append(HEX_CHARS[hi]); sb.append(HEX_CHARS[lo]); return sb.toString().trim(); ... |
String | toHexString(byte[] b, int off, int len) to Hex String StringBuffer buf = new StringBuffer(); int end = off + len; for (; off < end; off++) { buf.append(hexChars[(b[off] & 0xf0) >>> 4]); buf.append(hexChars[b[off] & 0x0f]); return buf.toString(); |
String | toHexString(byte[] b, int off, int len) Convert a byte array to a big-endian ordered hexadecimal string. char[] buf = new char[len * 2]; for (int i = 0, j = 0, k; i < len;) { k = b[off + i++]; buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; buf[j++] = HEX_DIGITS[k & 0x0F]; return new String(buf); |
String | toHexString(byte[] ba) to Hex String StringBuilder str = new StringBuilder(); for (int i = 0; i < ba.length; i++) { str.append(String.format("%x", new Object[] { Byte.valueOf(ba[i]) })); return str.toString(); |
String | toHexString(byte[] ba) Konvertiert ein Byte-Array in einen Hex-String mit zwei Hex-Zeichen je Byte. StringBuffer sb = new StringBuffer(ba.length * 2); for (byte element : ba) { sb.append(toHexString(element)); return sb.toString(); |
String | toHexString(byte[] ba, int offset, int length) converts String to Hex String. char[] buf; buf = new char[length * 2]; for (int i = offset, j = 0, k; i < offset + length;) { k = ba[i++]; buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; buf[j++] = HEX_DIGITS[k & 0x0F]; return new String(buf); ... |
String | toHexString(byte[] binary) To hex string. if (binary != null) { StringBuffer str = new StringBuffer(binary.length * 2); for (int i = 0; i < binary.length; i++) { int v = (binary[i] << 24) >>> 24; str.append((v < 0x10 ? "0" : "") + Integer.toHexString(v)); return str.toString(); return null; |
String | toHexString(byte[] binaryData) Creates a human-readable hex-String out of a byte-array (e.g. if (binaryData != null) { char[] text = new char[binaryData.length << 1]; int j = 0; byte b; for (int i = 0; i < binaryData.length; ++i) { b = binaryData[i]; text[j++] = hexDigits[(b & 0xf0) >> 4]; text[j++] = hexDigits[b & 0x0f]; ... |
String | toHexString(byte[] block) Converts a byte array to hex string StringBuffer buf = new StringBuffer(); int len = block.length; for (int i = 0; i < len; i++) { byte2hex(block[i], buf); if (i < len - 1) { buf.append(":"); return buf.toString(); |