public class BitConverter extends Object
| Constructor and Description |
|---|
BitConverter() |
| Modifier and Type | Method and Description |
|---|---|
static String |
bytesToHex(byte[] bytes) |
static String |
bytesToHex(byte[] bytes,
int end)
Converts the byte array into a string of hex values.
|
static String |
bytesToHex(byte[] bytes,
int offset,
int length) |
static byte[] |
hexToBytes(String hexString) |
static int |
intFromByteArray(byte[] sizeBuf,
int offset) |
static byte[] |
intToByteArray(int value) |
static short |
shortFromByteArray(byte[] sizeBuf,
int offset) |
static byte[] |
shortToByteArray(short value) |
public static String bytesToHex(byte[] bytes)
bytes - byte array that will be converted to hexpublic static String bytesToHex(byte[] bytes, int offset, int length)
bytes - byte array that will be converted to hexoffset - int representing the offset to begin conversion atlength - int representing number of bytes in array to convertpublic static byte[] hexToBytes(String hexString)
hexString - the String containing converted hex valuespublic static final byte[] intToByteArray(int value)
public static int intFromByteArray(byte[] sizeBuf,
int offset)
sizeBuf - byte array that will be converted to intoffset - The position indicating where to begin converting.public static final byte[] shortToByteArray(short value)
public static short shortFromByteArray(byte[] sizeBuf,
int offset)
sizeBuf - byte array that will be converted to shortoffset - The position indicating where to begin converting.public static String bytesToHex(byte[] bytes, int end)
bytes - byte array that will be converted to hexend - EXCLUSIVE so if it receives 10 it will print 0-9