Class Hex


  • public final class Hex
    extends Object
    Encodes and decodes to and from hexadecimal notation.
    Since:
    5.7
    • Method Detail

      • decode

        public static byte[] decode​(String s)
        Decode a hexadecimal string to a byte array. Note this method validates that characters in the given string are valid as digits in a hex string.
        Parameters:
        s - hexadecimal string
        Returns:
        decoded array
      • toHexString

        public static String toHexString​(byte[] b)
        Encode a byte array to a hexadecimal string.
        Parameters:
        b - byte array
        Returns:
        hexadecimal string