Java Utililty Methods XML Hex

List of utility methods to do XML Hex

Description

The list of methods to do XML Hex are organized into topic(s).

Method

byte[]fromHex(String hex)
from Hex
return DatatypeConverter.parseHexBinary(hex);
byte[]fromHex(String str)
from Hex
return DatatypeConverter.parseHexBinary(new String(reverseHEX(str.getBytes())));
byte[]getBytes(String hex)
get Bytes
return DatatypeConverter.parseHexBinary(hex);
StringgetFreshExecutionId()
get Fresh Execution Id
try {
    String id = DatatypeConverter.printBase64Binary(MessageDigest.getInstance("SHA-256")
            .digest(Long.toString(System.currentTimeMillis()).getBytes()));
    id = id.replace("/", "");
    id = id.replace("\\", "");
    return id;
} catch (NoSuchAlgorithmException nsae) {
    return "No_ID";
...
Stringhex(final byte[] bytes)
hex
return DatatypeConverter.printHexBinary(bytes);
byte[]hex2bin(String input)
hexbin
input = input.replace(" ", "");
return DatatypeConverter.parseHexBinary(input);
StringhexFromBinary(byte[] value)
Convert (encode) the given binary value to a hex string.
return DatatypeConverter.printHexBinary(value);
byte[]hexIn(String s)
Helper method to convert strings like: "F0A43205", to actual byte array for easier testing.
return DatatypeConverter.parseHexBinary(s);
StringhexOut(byte[] byteArray)
Make the byte array appear as hex number, without spaces.
if (byteArray == null) {
    return null;
} else {
    return DatatypeConverter.printHexBinary(byteArray);
StringhexOutSpaces(byte[] byteArray)
Make the byte array appear as space separated 2 digit hex numbers.
return toHexString(byteArray, true);