List of utility methods to do Byte Array to Hex String
String | bytesToHexSpaced(byte[] bytes) Turns a byte array into a hex-string representation, each byte is separated by a space char[] hexChars = new char[bytes.length * 3]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 3] = hexArray[v >>> 4]; hexChars[j * 3 + 1] = hexArray[v & 0x0F]; hexChars[j * 3 + 2] = ' '; return new String(hexChars); ... |
String | bytesToHexStr(byte[] bcd) bytes To Hex Str StringBuffer s = new StringBuffer(bcd.length * 2); for (int i = 0; i < bcd.length; i++) { s.append(bcdLookup[(bcd[i] >>> 4) & 0x0f]); s.append(bcdLookup[bcd[i] & 0x0f]); return s.toString(); |
String | bytesToHexStr(byte[] bytes) bytes To Hex Str StringBuilder stringBuilder = new StringBuilder(); for (byte b : bytes) { stringBuilder.append(byteToHexStr(b)); return stringBuilder.toString(); |
String | bytesToHexStr(byte[] bytes, int offset, int size) bytes To Hex Str char[] hexChars = new char[size * 2]; for (int i = offset; i < offset + size; i++) { int v = bytes[i] & 0xFF; hexChars[i * 2] = HEX_CHAR_ARRAY[v >>> 4]; hexChars[i * 2 + 1] = HEX_CHAR_ARRAY[v & 0x0F]; return new String(hexChars); |
String | bytesToHexString(byte abyte0[]) bytes To Hex String StringBuilder stringbuilder = new StringBuilder(""); if (abyte0 == null || abyte0.length <= 0) return null; for (int i = 0; i < abyte0.length; i++) { int j = abyte0[i] & 0xff; String s = Integer.toHexString(j); if (s.length() < 2) stringbuilder.append(0); ... |
String | bytesToHexString(byte abyte0[], int i, int j) bytes To Hex String StringBuffer stringbuffer = new StringBuffer("["); int k = Math.min(i + j, abyte0.length); for (int l = i; l < k; l++) { stringbuffer.append("0x"); stringbuffer.append(toHexString(0xff & abyte0[l])); if (l < k - 1) stringbuffer.append(", "); stringbuffer.append("]"); return stringbuffer.toString(); |
String | bytesToHexString(byte bytes[]) Converts a byte array to a hex string. StringBuilder sb = new StringBuilder(); for (byte b : bytes) sb.append(String.format("%02x", b)); return sb.toString(); |
String | bytesToHexString(byte data[]) bytes To Hex String StringBuilder sb = new StringBuilder(data.length * 2); for (int buc = 0; buc < data.length; buc++) { sb.append(HEX_DIGITS[(data[buc] >> 4) & 0x0F]); sb.append(HEX_DIGITS[data[buc] & 0x0F]); return sb.toString(); |
String | bytesToHexString(byte[] _bytes) Wandelt das ggb. StringBuffer sb = new StringBuffer(); for (int i = 0; i < _bytes.length; i++) { byte b = _bytes[i]; if ((b < 0) || (b > 0xf)) { sb.append(Integer.toHexString(b & 0xFF)); } else { sb.append('0'); sb.append(hexChars[b]); ... |
String | bytesToHexString(byte[] array) Converts the given byte array to a hexadecimal string that can be converted back by #hexStringToBytes(String) . StringBuilder sb = new StringBuilder(array.length * 2); for (int i = 0; i < array.length; ++i) { sb.append(HEX_CHARS[(array[i] >>> 4) & 0xF]); sb.append(HEX_CHARS[array[i] & 0xF]); return sb.toString(); |