Class UnsignedByte

java.lang.Object
ch.nolix.base.misc.dataobject.UnsignedByte

public final class UnsignedByte extends Object
A UnsignedByte is not mutable.
Author:
Silvan Wyss
  • Method Details

    • fromByte

      public static UnsignedByte fromByte(byte paramByte)
      Parameters:
      paramByte -
      Returns:
      a new UnsignedByte from the given paramByte.
    • fromNumber

      public static UnsignedByte fromNumber(int number)
      Parameters:
      number -
      Returns:
      a new UnsignedByte from 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 UnsignedByte with 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 UnsignedByte as int.
    • toBitString

      public String toBitString()
      Returns:
      a String with the bits of the current UnsignedByte.
    • toByte

      public byte toByte()
      Returns:
      the current UnsignedByte as byte.
    • toInt

      public int toInt()
      Returns:
      the current UnsignedByte as int.