Class HexTools


  • public class HexTools
    extends java.lang.Object
    Helper class for faster mapping of bytes to their hex equivalent
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static byte[][] ByteToHex
      ASCII byte values for the hex strings.
      static byte[][] byteToHexLower
      ASCII byte values for the hex strings.
    • Constructor Summary

      Constructors 
      Constructor Description
      HexTools()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String bytesToHexString​(byte[] data)  
      static java.lang.String bytesToHexString​(byte[] data, int offset, int length)  
      static java.lang.String bytesToHexString​(byte[] data, int offset, int length, boolean space)  
      static int hexDigitToInt​(char c)
      The numeric value for the hex digit, return -1 if not valid digit
      static byte[] hexStringToBytes​(java.lang.String hexString)  
      static int hexStringToInt​(java.lang.String hexString)  
      static boolean isHexDigit​(char i)
      Evaluate to true if i is a valid hex digit
      • Methods inherited from class java.lang.Object

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

      • ByteToHex

        public static final byte[][] ByteToHex
        ASCII byte values for the hex strings.
      • byteToHexLower

        public static final byte[][] byteToHexLower
        ASCII byte values for the hex strings.
    • Constructor Detail

      • HexTools

        public HexTools()
    • Method Detail

      • bytesToHexString

        public static java.lang.String bytesToHexString​(byte[] data)
      • bytesToHexString

        public static java.lang.String bytesToHexString​(byte[] data,
                                                        int offset,
                                                        int length)
      • bytesToHexString

        public static java.lang.String bytesToHexString​(byte[] data,
                                                        int offset,
                                                        int length,
                                                        boolean space)
      • hexDigitToInt

        public static int hexDigitToInt​(char c)
        The numeric value for the hex digit, return -1 if not valid digit
        Parameters:
        c - A char representing a hex digit.
        Returns:
        The numeric value of the hex digit
      • hexStringToBytes

        public static byte[] hexStringToBytes​(java.lang.String hexString)
      • hexStringToInt

        public static int hexStringToInt​(java.lang.String hexString)
      • isHexDigit

        public static boolean isHexDigit​(char i)
        Evaluate to true if i is a valid hex digit
        Parameters:
        i - A char representing a hex digit.
        Returns:
        true if i is a valid hex digit.