|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Number net.sourceforge.juint.UInt16
public class UInt16
Unsigned 16-bit integer.
Field Summary | |
---|---|
static int |
MAX_VALUE
The largest possible value. |
static int |
MIN_VALUE
The smallest possible value. |
Constructor Summary | |
---|---|
UInt16(byte[] word)
Creates a new instance from a byte array. |
|
UInt16(int word)
Creates a new instance from an int . |
|
UInt16(long word)
Creates a new instance from a long . |
|
UInt16(short word)
Creates a new instance from a short . |
Method Summary | |
---|---|
UInt16 |
addBitmask(UInt16 bitmask)
Sets the bits in the given bitmask. |
UInt16 |
and(UInt16 number)
Logical and. |
int |
compareTo(java.lang.Object object)
Compares this UInt16 to another UInt16 for order. |
double |
doubleValue()
Gets the value as a double . |
boolean |
equals(java.lang.Object object)
Compares this UInt16 to anoter UInt16 for equality. |
float |
floatValue()
Gets the value as a float . |
boolean |
hasBitmask(UInt16 bitmask)
Determines if this number has the given bitmask. |
int |
hashCode()
Gets the hash code. |
int |
intValue()
Gets the value as an int . |
long |
longValue()
Gets the value as a long . |
UInt16 |
not()
Logical not. |
UInt16 |
or(UInt16 number)
Logical or. |
UInt16 |
removeBitmask(UInt16 bitmask)
Unsets the bits in the given bitmask. |
byte[] |
toBigEndian()
Gets the value as a byte array. |
byte[] |
toLittleEndian()
Gets the value as a byte array. |
java.lang.String |
toString()
Gets the value as a String . |
int |
uint16Value()
Gets the value as an unsigned 16-bit integer. |
static UInt16 |
valueOfBigEndian(byte[] word)
Creates a new instance from a byte array. |
static UInt16 |
valueOfLittleEndian(byte[] word)
Creates a new instance from a byte array. |
UInt16 |
xor(UInt16 number)
Logical xor. |
Methods inherited from class java.lang.Number |
---|
byteValue, shortValue |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_VALUE
65535
public static final int MIN_VALUE
0
Constructor Detail |
---|
public UInt16(byte[] word) throws java.lang.IllegalArgumentException
byte
array. The array must have a length of 2
and be in big-endian byte order.
word
- the value to be represented
java.lang.IllegalArgumentException
- if word
is null
or if the length does not equal 2public UInt16(short word)
short
.
word
- the value to be representedpublic UInt16(int word)
int
.
word
- the value to be representedpublic UInt16(long word)
long
.
word
- the value to be representedMethod Detail |
---|
public static UInt16 valueOfBigEndian(byte[] word) throws java.lang.IllegalArgumentException
byte
array. The array must have a length of 2
and be in big-endian byte order.
word
- the value to be represented
java.lang.IllegalArgumentException
- if word
is null
or if the length does not equal 2public static UInt16 valueOfLittleEndian(byte[] word) throws java.lang.IllegalArgumentException
byte
array. The array must have a length of 2
and be in little-endian byte order.
word
- the value to be represented
java.lang.IllegalArgumentException
- if word
is null
or if the length does not equal 2public int uint16Value()
public int intValue()
int
.
intValue
in class java.lang.Number
int
public long longValue()
long
.
longValue
in class java.lang.Number
long
public float floatValue()
float
.
floatValue
in class java.lang.Number
float
public double doubleValue()
double
.
doubleValue
in class java.lang.Number
double
public byte[] toBigEndian()
byte
array. The array will be in big-endian byte order and
have a length of 2.
byte
arraypublic byte[] toLittleEndian()
byte
array. The array will be in litte-endian byte order
and have a length of 2.
byte
arraypublic int compareTo(java.lang.Object object)
UInt16
to another UInt16
for order.
compareTo
in interface java.lang.Comparable
object
- a UInt16
public boolean equals(java.lang.Object object)
UInt16
to anoter UInt16
for equality.
equals
in class java.lang.Object
object
- a UInt16
public int hashCode()
intValue()
.
hashCode
in class java.lang.Object
public java.lang.String toString()
String
.
toString
in class java.lang.Object
String
public UInt16 and(UInt16 number)
Bitwise
and
in interface Bitwise<UInt16>
public UInt16 not()
Bitwise
not
in interface Bitwise<UInt16>
public UInt16 or(UInt16 number)
Bitwise
or
in interface Bitwise<UInt16>
public UInt16 xor(UInt16 number)
Bitwise
xor
in interface Bitwise<UInt16>
public UInt16 addBitmask(UInt16 bitmask)
Bitwise
addBitmask
in interface Bitwise<UInt16>
public boolean hasBitmask(UInt16 bitmask)
Bitwise
hasBitmask
in interface Bitwise<UInt16>
true
if the number has the bitmask; false
otherwisepublic UInt16 removeBitmask(UInt16 bitmask)
Bitwise
removeBitmask
in interface Bitwise<UInt16>
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |