Class HexUtil


  • public class HexUtil
    extends java.lang.Object
    Library of utility methods to convert byte arrays to and from strings of hexadecimal digits.
    • Constructor Summary

      Constructors 
      Constructor Description
      HexUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String convert​(byte[] bytes)
      Converts a byte array into a printable String of hexadecimal digits.
      static byte[] convert​(java.lang.String digits)
      Converts a String of hexadecimal digits into a byte array.
      • Methods inherited from class java.lang.Object

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

      • HexUtil

        public HexUtil()
    • Method Detail

      • convert

        public static java.lang.String convert​(byte[] bytes)
        Converts a byte array into a printable String of hexadecimal digits.
        Parameters:
        bytes - byte array to convert
        Returns:
        a printable String of hexadecimal digits
      • convert

        public static byte[] convert​(java.lang.String digits)
        Converts a String of hexadecimal digits into a byte array.
        Parameters:
        digits - string of hexadecimal digits
        Returns:
        the original byte array
        Throws:
        java.lang.IllegalArgumentException - if the string of hexadecimal digits is invalid