Class UnsignedByte

java.lang.Object
org.drasyl.util.UnsignedByte

public final class UnsignedByte extends Object
This class represents an unsigned short in a rang of [0, 256).
  • Field Details

  • Method Details

    • getValue

      public short getValue()
      Returns:
      the value as short.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • of

      public static UnsignedByte of(short value)
      Creates a new UnsignedByte.
      Parameters:
      value - the value as integer
      Returns:
      an unsigned byte
      Throws:
      IllegalArgumentException - if the value is not in range of [0, 256).
    • of

      public static UnsignedByte of(byte value)
      Creates a new UnsignedShort.
      Parameters:
      value - the value as byte array in big-endian (BE) format
      Returns:
      an unsigned byte
      Throws:
      IllegalArgumentException - if the value is not in range of [0, 256).