List of utility methods to do Byte Array to Hex
String | byteToHex(byte[] array, String separator) Converts a byte array to a hex string. assert array != null; StringBuilder buffer = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i != 0) { buffer.append(separator); if ((array[i] & 0xff) < 0x10) { buffer.append("0"); ... |
String | byteToHex(byte[] b, int size) byte To Hex return byteToHex(b, size, true);
|
String | byteToHex(byte[] base) byte To Hex char[] c = new char[base.length * 2]; int i = 0; for (byte b : base) { int j = b; j = j + 128; c[i++] = TOHEX[j / 0x10]; c[i++] = TOHEX[j % 0x10]; return new String(c); |
String | byteToHex(byte[] buf) converting a byte[] to it's hexadecimal format String if (buf == null) return null; return byteToHex(buf, 0, buf.length); |
String | byteToHex(byte[] buffer) byte To Hex StringBuffer hexString = new StringBuffer(); String hex; int iValue; for (int i = 0; i < buffer.length; i++) { iValue = buffer[i]; if (iValue < 0) iValue += 256; hex = Integer.toString(iValue, 16); ... |
String | ByteToHex(byte[] bytes) Byte To Hex StringBuffer sha1StrBuff = new StringBuffer(); for (int i = 0; i < bytes.length; ++i) { if (Integer.toHexString(255 & bytes[i]).length() == 1) { sha1StrBuff.append("0").append(Integer.toHexString(255 & bytes[i])); } else { sha1StrBuff.append(Integer.toHexString(255 & bytes[i])); return sha1StrBuff.toString(); |
String | byteToHex(byte[] content, int nLength) byte To Hex StringBuilder sb = new StringBuilder(); int nPos = 0; while (nPos < nLength) { int nByteLength = sb.length(); sb.append(toHex(content[nPos], 2)).append(" "); nPos++; return sb.toString(); ... |
String | byteToHex(byte[] raw) byte To Hex String hex_tab = "0123456789abcdef"; StringBuffer sb = new StringBuffer(); for (int i = 0; i < raw.length; i++) { byte b = raw[i]; sb.append(hex_tab.charAt((b & 0xF0) >> 4)); sb.append(hex_tab.charAt(b & 0xF)); return sb.toString(); ... |
String | byteToHex(final byte b) byte To Hex final char byteHexChar1 = HEX_CHARS[(b & 0xf0) >> 4]; final char byteHexChar2 = HEX_CHARS[b & 0x0f]; return byteHexChar1 + "" + byteHexChar2; |
String | byteToHex(final byte b) Convert a byte into a hex string. StringBuilder sb = new StringBuilder(2); sb.append(hexChar[(b & 0xF0) >>> 4]); sb.append(hexChar[b & 0x0F]); return sb.toString(); |