Class HexUtil


  • public class HexUtil
    extends java.lang.Object
    Static helper methods for working with hex values.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String bytesToHex​(byte[] bytes)
      translate a byte array of raw data into a String with a hex representation of that data
      static java.lang.String bytesToHex​(byte[] bytes, java.lang.String separator)
      translate a byte array of raw data into a String with a hex representation of that data.
      static byte[] hexToBytes​(java.lang.String str)
      Converts a Hex encoded String into a byte vector.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • bytesToHex

        public static java.lang.String bytesToHex​(byte[] bytes)
        translate a byte array of raw data into a String with a hex representation of that data
        Parameters:
        bytes - raw binary data
        Returns:
        String Hex representation of the raw data
      • bytesToHex

        public static java.lang.String bytesToHex​(byte[] bytes,
                                                  java.lang.String separator)
        translate a byte array of raw data into a String with a hex representation of that data. Each octet will be separated with a specific separator.
        Parameters:
        bytes - raw binary data
        separator - This string will be injected into the output in between each octet in the stream
        Returns:
        String Hex representation of the raw data with each octet separated by 'separator'
      • hexToBytes

        public static byte[] hexToBytes​(java.lang.String str)
        Converts a Hex encoded String into a byte vector.
        Parameters:
        str - The String to be encoded.
        Returns:
        A byte vector representing the String.