public final class HexString extends Object
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
fromHexString(String values)
Convert a colon-separated hex string to byte array.
|
static byte[] |
fromHexString(String values,
String separator)
Convert a hex-string with arbitrary separator to byte array.
|
static String |
toHexString(byte[] bytes)
Convert a byte array to a colon-separated hex string.
|
static String |
toHexString(byte[] bytes,
String separator)
Convert a byte array to a hex string separated by given separator.
|
static String |
toHexString(long val)
Convert a long number to colon-separated hex string.
|
static String |
toHexString(long val,
int padTo)
Convert a long number to colon-separated hex string.
|
static long |
toLong(String value)
Convert a colon-separated hex string to long.
|
public static String toHexString(byte[] bytes)
bytes - byte array to be convertedpublic static String toHexString(byte[] bytes, String separator)
bytes - byte array to be convertedseparator - the string use to separate each bytepublic static String toHexString(long val, int padTo)
val - long number to be convertedpadTo - prepend zeros until this lengthpublic static String toHexString(long val)
val - long number to be convertedpublic static byte[] fromHexString(String values)
values - colon-separated hex string to be converted,
e.g. "0f:ca:fe:de:ad:be:ef"NumberFormatException - if input hex string cannot be parsedpublic static byte[] fromHexString(String values, String separator)
values - hex string to be convertedseparator - regex for separatorNumberFormatException - if input hex string cannot be parsedpublic static long toLong(String value)
value - colon-separated hex string to be converted,
e.g. "00:0f:ca:fe:de:ad:be:ef"NumberFormatException - if input hex string cannot be parsed