Class Bits
java.lang.Object
net.emustudio.emulib.Bits
Bits utility class. Supports various operations on bits.
It supports maximally 32 bits, because it works with an integer.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
number
public final int numberThe integer number in little endian. -
length
public final int lengthSignificant bits count.
-
-
Constructor Details
-
Bits
public Bits(int number, int length) Constructs new Bits object.- Parameters:
number- integer number in little endianlength- significant bits count
-
-
Method Details
-
toBytes
public byte[] toBytes()Converts the bits to byte array in little endian. The size of the array is always 4 bytes.- Returns:
- byte array representing the bits in little endian
-
reverseBytes
-
reverseBits
-
absolute
-
shiftLeft
-
shiftRight
-