List of utility methods to do XML Hex
String | byteArrayToHex(final byte[] arr) Converts a byte array into a hex representation with a space between each byte e.g 00 00 01 00 05 59 B3 final StringBuilder sb = new StringBuilder(); if (arr != null) { for (final byte b : arr) { final byte[] oneByteArr = new byte[1]; oneByteArr[0] = b; sb.append(DatatypeConverter.printHexBinary(oneByteArr)); sb.append(" "); return sb.toString().replaceAll(" $", ""); |
String | byteArrayToHexString(byte[] bytes) Convert a byte array into a hex string. return DatatypeConverter.printHexBinary(bytes);
|
String | bytesToHex(byte[] b) bytes To Hex return javax.xml.bind.DatatypeConverter.printHexBinary(b);
|
String | bytesToHex(byte[] bytes) Convert an array of bytes to it's Hex-String representation return javax.xml.bind.DatatypeConverter.printHexBinary(bytes);
|
String | bytesToHex(final byte[] bytes) Converts the passed bytes to a hex string return bytes == null ? "" : DatatypeConverter.printHexBinary(bytes); |
String | bytesToHexStr(byte[] array) bytes To Hex Str if (array == null) return null; else return DatatypeConverter.printHexBinary(array); |
String | convertByteArrayToHexString(byte[] byteArray) Converts a Byte Array to Hex String. return DatatypeConverter.printHexBinary(byteArray);
|
String | convertStringToHex(String str) convert String To Hex char[] chars = str.toCharArray(); StringBuffer hex = new StringBuffer(); for (int i = 0; i < chars.length; i++) { hex.append(Integer.toHexString((int) chars[i])).append(" "); return hex.toString(); |
String | encodeHex(byte[] bytes) Turns an array of bytes into a String representing each byte as an unsigned hex number. return DatatypeConverter.printHexBinary(bytes).toLowerCase();
|
byte[] | fromHex(String hex) Convert provided hex string representation in format AA:FF:47:11 byte array. if (hex != null) { return DatatypeConverter.parseHexBinary(hex.replaceAll("[^0-9a-fA-F]+", "")); return new byte[0]; |