public class Hex
extends java.lang.Object
#DEFAULT_CHARSET_NAME
This class is thread-safe.Constructor and Description |
---|
Hex() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(char[] data)
Converts an array of characters representing hexadecimal values into an array of bytes of those same values.
|
static byte[] |
decode(java.lang.String data) |
static char[] |
encode(byte[] data)
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
|
static char[] |
encode(byte[] data,
boolean toLowerCase)
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
|
static java.lang.String |
encodeToString(byte[] data)
Converts an array of bytes into a String representing the hexadecimal values of each byte in order.
|
static java.lang.String |
encodeToString(byte[] data,
boolean toLowerCase)
Converts an array of bytes into a String representing the hexadecimal values of each byte in order.
|
public static char[] encode(byte[] data)
data
- a byte[] to convert to Hex characterspublic static char[] encode(byte[] data, boolean toLowerCase)
data
- a byte[] to convert to Hex characterstoLowerCase
- true
converts to lowercase, false
to uppercasepublic static java.lang.String encodeToString(byte[] data)
data
- a byte[] to convert to Hex characterspublic static java.lang.String encodeToString(byte[] data, boolean toLowerCase)
data
- a byte[] to convert to Hex characterstoLowerCase
- true
converts to lowercase, false
to uppercasepublic static byte[] decode(java.lang.String data) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static byte[] decode(char[] data) throws java.lang.IllegalArgumentException
data
- An array of characters containing hexadecimal digitsDecoderException
- Thrown if an odd number or illegal of characters is suppliedjava.lang.IllegalArgumentException