List of utility methods to do Byte Array to Hex Convert
String | getHexString(byte[] raw) Convert a byte array into a hex string representation if (raw == null) { return ""; byte[] hex = new byte[2 * raw.length]; int index = 0; for (int i = 0; i < raw.length; i++) { byte b = raw[i]; int v = b & 0xFF; ... |
String | byte2hex(byte[] b) bytehex String hs = ""; String stmp = ""; for (int n = 0; n < b.length; n++) { stmp = Integer.toHexString(b[n] & 0XFF); if (stmp.length() == 1) hs = hs + "0" + stmp; else hs = hs + stmp; ... |
String | bytes2HexString(byte[] data) bytes Hex String String ret = ""; for (int i = 0; i < data.length; i++) { String hex = Integer.toHexString(data[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; ret += hex.toUpperCase(); return ret; |
String | bytes2HexString(byte[] data) bytes Hex String StringBuffer sb = new StringBuffer(32); for (byte b : data) { char low = DIGITS[b & 0x0F]; char high = DIGITS[(b & 0xF0) >>> 4]; sb.append(high); sb.append(low); return sb.toString(); ... |
String | toHexString(byte[] b) to Hex String char HEX_DIGITS[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; StringBuilder sb = new StringBuilder(b.length * 2); for (int i = 0; i < b.length; i++) { sb.append(HEX_DIGITS[(b[i] & 0xf0) >>> 4]); sb.append(HEX_DIGITS[b[i] & 0x0f]); return sb.toString(); ... |
String | byteArrayToHexString(byte[] data) byte Array To Hex String StringBuilder sb = new StringBuilder(data.length * 2); for (byte b : data) { int v = b & 0xff; if (v < 16) { sb.append('0'); sb.append(Integer.toHexString(v)); return sb.toString().toUpperCase(Locale.getDefault()); |
String | bytesToHexString(byte[] bArray) bytes To Hex String StringBuffer sb = new StringBuffer(bArray.length); String sTemp; for (int i = 0; i < bArray.length; i++) { sTemp = Integer.toHexString(0xFF & bArray[i]); if (sTemp.length() < 2) sb.append(0); sb.append(sTemp.toUpperCase()); return sb.toString(); |
String | toHexadecimealString(byte[] data) to Hexadecimeal String StringBuffer bff = new StringBuffer(); for (byte b : data) bff.append(String.format("%02X", b)); return bff.toString(); |
String | bytesToHex(byte[] bytes) bytes To Hex char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = HEX[v >>> 4]; hexChars[j * 2 + 1] = HEX[v & 0x0F]; return new String(hexChars); |
String | byte2hex(byte buffer) bytehex String h = Integer.toHexString(buffer & 0xFF); if (h.length() == 1) { h = "0" + h; return h; |