public final class HexUtil extends Object
Modifier and Type | Field and Description |
---|---|
static char[] |
DIGITS |
Modifier and Type | Method and Description |
---|---|
static void |
appendHex(StringBuilder builder,
int b)
Deprecated.
|
static String |
bytesToHex(byte[] bs) |
static String |
bytesToHex(byte[] bs,
int off,
int length)
Converts a byte array into a string of lower case hex chars.
|
static void |
bytesToHexAppend(byte[] bs,
int off,
int length,
Appendable appendable) |
static String |
formatByte(int b)
Deprecated.
|
static String |
formatBytes(byte[] bytes)
Deprecated.
|
static byte[] |
hexToBytes(String s) |
static void |
hexToBytes(String s,
byte[] out,
int off)
Converts a String of hex characters into an array of bytes.
|
static byte[] |
hexToBytes(String s,
int off) |
static String |
longToHex(long v) |
public static String bytesToHex(byte[] bs, int off, int length)
bs
- A byte arrayoff
- The index of the first byte to readlength
- The number of bytes to read.public static void bytesToHexAppend(byte[] bs, int off, int length, Appendable appendable)
public static String bytesToHex(byte[] bs)
public static byte[] hexToBytes(String s)
public static byte[] hexToBytes(String s, int off)
public static void hexToBytes(String s, byte[] out, int off) throws NumberFormatException, IndexOutOfBoundsException
s
- A string of hex characters (upper case or lower) of even length.out
- A byte array of length at least s.length()/2 + offoff
- The first byte to write of the arrayNumberFormatException
IndexOutOfBoundsException
public static String longToHex(long v)
@Deprecated public static String formatByte(int b)
@Deprecated public static String formatBytes(byte[] bytes)
@Deprecated public static void appendHex(StringBuilder builder, int b)
Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.