Package org.drasyl.util
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 Summary
Fields Modifier and Type Field Description static UnsignedByte
MAX_VALUE
static UnsignedByte
MIN_VALUE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
short
getValue()
int
hashCode()
static UnsignedByte
of(byte value)
Creates a newUnsignedShort
.static UnsignedByte
of(short value)
Creates a newUnsignedByte
.String
toString()
-
-
-
Field Detail
-
MIN_VALUE
public static final UnsignedByte MIN_VALUE
-
MAX_VALUE
public static final UnsignedByte MAX_VALUE
-
-
Method Detail
-
getValue
public short getValue()
- Returns:
- the value as short.
-
of
public static UnsignedByte of(short value)
Creates a newUnsignedByte
.- 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 newUnsignedShort
.- 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).
-
-