Package de.intarsys.tools.hex
Class HexTools
java.lang.Object
de.intarsys.tools.hex.HexTools
Helper class for faster mapping of bytes to their hex equivalent
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte[][]
ASCII byte values for the hex strings.static final byte[][]
ASCII byte values for the hex strings. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
bytesToHexString
(byte[] data) static String
bytesToHexString
(byte[] data, int offset, int length) static 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 digitstatic byte[]
hexStringToBytes
(String hexString) static int
hexStringToInt
(String hexString) static boolean
isHexDigit
(char i) Evaluate totrue
ifi
is a valid hex digit
-
Field Details
-
ByteToHex
public static final byte[][] ByteToHexASCII byte values for the hex strings. -
byteToHexLower
public static final byte[][] byteToHexLowerASCII byte values for the hex strings.
-
-
Constructor Details
-
HexTools
public HexTools()
-
-
Method Details
-
bytesToHexString
-
bytesToHexString
-
bytesToHexString
-
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
-
hexStringToInt
-
isHexDigit
public static boolean isHexDigit(char i) Evaluate totrue
ifi
is a valid hex digit- Parameters:
i
- A char representing a hex digit.- Returns:
true
ifi
is a valid hex digit.
-