List of utility methods to do Byte Array to Hex
String | bufferToHex(byte bytes[]) buffer To Hex return bufferToHex(bytes, 0, bytes.length);
|
String | bufferToHexString(byte[] buffer) Convert a byte buffer to a hexadecimal string. StringBuffer sb = new StringBuffer(buffer.length * 2); for (int i = 0; i < buffer.length; i++) { char a = HEX_CHARS[(buffer[i] & 0xF0) >> 4]; char b = HEX_CHARS[buffer[i] & 0x0F]; sb.append(a); sb.append(b); return sb.toString(); ... |
String | bufferToHexString(byte[] data, int start, int length) buffer To Hex String int i; int myStop; StringBuilder sb = new StringBuilder(); myStop = (length > data.length) ? data.length : length; for (i = start; i < start + myStop; i++) { sb.append(String.format("%02x ", data[i])); return sb.toString(); ... |
String | bytes2Hex(byte bt) bytes Hex return ("" + "0123456789ABCDEF".charAt(0xf & bt >> 4) + "0123456789ABCDEF".charAt(bt & 0xf)); |
String | bytes2Hex(byte... values) bytes Hex StringBuffer bf = new StringBuffer(); for (byte b : values) { String str = byte2Hex(b, false); bf.append(str); return bf.toString(); |
String | bytes2Hex(byte[] abValue) bytes Hex if (abValue == null) { return null; String sTemp; StringBuffer sbHex = new StringBuffer(); for (int i = 0; i < abValue.length; i++) { sTemp = Integer.toHexString(abValue[i] & 0XFF); if (1 == sTemp.length()) { ... |
String | bytes2Hex(byte[] b) bytes Hex StringBuilder sb = new StringBuilder(1024); for (int n = 0; n < b.length; n++) { String s = Integer.toHexString(b[n] & 0xFF); sb.append((s.length() == 1) ? "0" + s : s); return sb.toString(); |
String | bytes2Hex(byte[] b) bytes Hex StringBuilder str = new StringBuilder(); for (int i = 0; i < b.length; i++) { int _b = ((int) b[i]) & 0xff; char upper = Character.forDigit(_b / 16, 16); char lower = Character.forDigit(_b % 16, 16); str.append(upper); str.append(lower); return str.toString(); |
String | bytes2Hex(byte[] bts) bytes Hex String des = ""; String tmp = null; for (int i = 0; i < bts.length; i++) { tmp = Integer.toHexString(bts[i] & 0xFF); if (tmp.length() == 1) { des = des + "0"; des = des + tmp; ... |
String | bytes2Hex(byte[] bts) bytes Hex String des = ""; String tmp = null; for (int i = 0; i < bts.length; i++) { tmp = (Integer.toHexString(bts[i] & 0xFF)); if (tmp.length() == 1) { des += "0"; des += tmp; ... |