public class LittleBitConverter extends Object
Constructor and Description |
---|
LittleBitConverter() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
GetBytes(int value)
Returns the specified 32-bit signed integer value as an array of bytes.
|
static byte[] |
GetBytes(short value)
Returns the specified 16-bit signed integer value as an array of bytes.
|
static short |
ToInt16(byte[] bytes,
int offset)
Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array.
|
static int |
ToInt32(byte[] bytes,
int offset)
Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array.
|
static int |
ToUInt16(byte[] bytes,
int offset)
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.
|
static long |
ToUInt32(byte[] bytes,
int offset)
Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array.
|
static long |
ToUInt64(byte[] bytes,
int offset)
Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array.
|
public static byte[] GetBytes(int value)
value
- The number to convert.public static byte[] GetBytes(short value)
value
- The number to convert.public static short ToInt16(byte[] bytes, int offset)
bytes
- An array of bytesoffset
- The starting position within valuepublic static int ToInt32(byte[] bytes, int offset)
bytes
- An array of bytesoffset
- The starting position within valuepublic static int ToUInt16(byte[] bytes, int offset)
bytes
- An array of bytesoffset
- The starting position within valuepublic static long ToUInt32(byte[] bytes, int offset)
bytes
- An array of bytesoffset
- The starting position within valuepublic static long ToUInt64(byte[] bytes, int offset)
bytes
- An array of bytesoffset
- The starting position within value