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