Class UnsignedByte
java.lang.Object
ch.nolix.base.misc.dataobject.UnsignedByte
-
Method Summary
Modifier and TypeMethodDescriptionstatic UnsignedBytefromByte(byte paramByte) static UnsignedBytefromNumber(int number) booleangetBitAt(int index) intgetBitAtAsInt(int index) bytetoByte()inttoInt()static UnsignedBytewithBits(int bit1, int bit2, int bit3, int bit4, int bit5, int bit6, int bit7, int bit8)
-
Method Details
-
fromByte
- Parameters:
paramByte-- Returns:
- a new
UnsignedBytefrom the given paramByte.
-
fromNumber
- Parameters:
number-- Returns:
- a new
UnsignedBytefrom the given number. - Throws:
RuntimeException- if the given number is not in [0, 255].
-
withBits
public static UnsignedByte withBits(int bit1, int bit2, int bit3, int bit4, int bit5, int bit6, int bit7, int bit8) - Parameters:
bit1-bit2-bit3-bit4-bit5-bit6-bit7-bit8-- Returns:
- a new
UnsignedBytewith the given bits.
-
getBitAt
public boolean getBitAt(int index) - Parameters:
index-- Returns:
- the bit at the given index from the current
UnsignedByte.
-
getBitAtAsInt
public int getBitAtAsInt(int index) - Parameters:
index-- Returns:
- the bit at the given index from the current
UnsignedByteas int.
-
toBitString
- Returns:
- a
Stringwith the bits of the currentUnsignedByte.
-
toByte
public byte toByte()- Returns:
- the current
UnsignedByteas byte.
-
toInt
public int toInt()- Returns:
- the current
UnsignedByteas int.
-