public class NumberUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NumberUtils.Strategy
Strategy defining how to manipulate with bytes.
|
| Constructor and Description |
|---|
NumberUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
readInt(Byte[] word,
int strategy)
Reads an integer from the array of numbers.
|
static int |
readInt(Integer[] word,
int strategy)
Reads an integer from the array of numbers.
|
static int |
reverseBits(int value,
int numberOfBits)
Reverse bits in integer (max 32-bit) value.
|
static Byte[] |
toObjectArray(byte[] array) |
static void |
writeInt(int value,
Byte[] output,
int strategy)
Split the value into 4 bytes.
|
static void |
writeInt(int value,
Integer[] output,
int strategy)
Split the value into 4 bytes.
|
static void |
writeInt(int value,
Short[] output,
int strategy)
Split the value into 4 bytes.
|
public static int reverseBits(int value,
int numberOfBits)
value - value which bits will be reversednumberOfBits - how many bits should be reversed. If the value has more bits, the rest will be ignored.public static Byte[] toObjectArray(byte[] array)
public static int readInt(Byte[] word, int strategy)
word - the array of 4 bytesstrategy - strategy how to deal with the array. See Strategy class for more information.public static int readInt(Integer[] word, int strategy)
word - the array of 4 bytesstrategy - strategy how to deal with the array. See Strategy class for more information.public static void writeInt(int value,
Integer[] output,
int strategy)
value - The value which should be split into bytes. It is assumed that it is always in native little endian.output - The output array. Must have space for 4 bytes. If the array is larger, other elements are ignored.strategy - strategy for how to save the value. See Strategy class for more information.public static void writeInt(int value,
Byte[] output,
int strategy)
value - The value which should be split into bytes. It is assumed that it is always in native little endian.output - The output array. Must have space for 4 bytes. If the array is larger, other elements are ignored.strategy - strategy for how to save the value. See Strategy class for more information.public static void writeInt(int value,
Short[] output,
int strategy)
value - The value which should be split into bytes. It is assumed that it is always in native little endian.output - The output array. Must have space for 4 bytes. If the array is larger, other elements are ignored.strategy - strategy for how to save the value. See Strategy class for more information.Copyright © 2017. All rights reserved.