Class HexUtils

java.lang.Object
org.apache.camel.converter.crypto.HexUtils

public final class HexUtils extends Object
HexUtils provides utility methods for hex conversions
  • Method Details

    • byteArrayToHexString

      public static String byteArrayToHexString(byte[] in, int start, int length)
      Creates a string representation of the supplied byte array in Hexidecimal format
      Parameters:
      in - the byte array to convert to a hex string.
      start - where to begin in the array
      length - how many bytes from the array to include in the hexidecimal representation
      Returns:
      a string containing the hexidecimal representation of the requested bytes from the array
    • byteArrayToHexString

      public static String byteArrayToHexString(byte[] in)
      Creates a string representation of the supplied byte array in Hexidecimal format
      Parameters:
      in - the byte array to convert to a hex string.
      Returns:
      a string containing the hexidecimal representation of the array
    • hexToByteArray

      public static byte[] hexToByteArray(String hexString)
      Convert a hex string into an array of bytes. The string is expected to consist entirely of valid Hex characters i.e. 0123456789abcdefABCDEF. The array is calculated by traversing the string from from left to right, ignoring whitespace. Every 2 valid hex chars will constitute a new byte for the array. If the string is uneven then it the last byte will be padded with a '0'.
      Parameters:
      hexString - String to be converted
    • isHexChar

      public static boolean isHexChar(char current)