List of utility methods to do Byte Array to Hex Convert
String | byteArrayToHexString(byte[] bytes) byte Array To Hex String int oldLength = bytes.length; byte[] positiveBytes = new byte[oldLength + 1]; System.arraycopy(bytes, 0, positiveBytes, 1, oldLength); positiveBytes[0] = 1; BigInteger bigInt = new BigInteger(positiveBytes); String hex = bigInt.toString(16); return hex.substring(1); |
String | bytesToHex(byte[] data) Convenience method to convert a byte array to a hex string. StringBuffer buf = new StringBuffer(); for (int i = 0; i < data.length; i++) { buf.append(byteToHex(data[i]).toUpperCase()); return (buf.toString()); |
String | convertToHex(byte[] in) convert To Hex StringBuilder builder = new StringBuilder(in.length * 2); Formatter formatter = new Formatter(builder); for (byte inByte : in) formatter.format("%02x", inByte); formatter.close(); return formatter.toString(); |
String | convertToHex(byte[] raw) convert To Hex final StringBuilder hex = new StringBuilder(raw.length * 2); for (final byte b : raw) { hex.append(HEX_DIGITS.charAt((b & 0xF0) >> 4)).append( HEX_DIGITS.charAt((b & 0x0F))); return hex.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 += "0"; des += tmp; ... |
String | bytes2HexString(byte[] bytes) bytes Hex String if (bytes == null) return null; StringBuilder ret = new StringBuilder(2 * bytes.length); for (int i = 0; i < bytes.length; i++) { int b; b = 0x0f & (bytes[i] >> 4); ret.append("0123456789ABCDEF".charAt(b)); b = 0x0f & bytes[i]; ... |
String | bytes2hex(byte[] bytes) byteshex StringBuffer strbuf = new StringBuffer(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { int bt = bytes[i] & 0xff; if (bt < 0x10) { strbuf.append("0"); strbuf.append(Integer.toHexString(bt)); return strbuf.toString(); |
String | bytesToHex(byte[] bytes) Convert Byte array to Hex (string) char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; return new String(hexChars); |
String | bytesToHex(byte[] data) Convenience method to convert a byte array to a hex string. StringBuilder buf = new StringBuilder(); for (int i = 0; i < data.length; i++) { buf.append(byteToHex(data[i]).toUpperCase()); return (buf.toString()); |
String | bytesToHex(byte[] data) bytes To Hex return bytesToHex(data, 0, data.length);
|