|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
net.sourceforge.juint.Int16
public class Int16
Signed 16-bit integer.
Field Summary | |
---|---|
static short |
MAX_VALUE
The largest possible value. |
static short |
MIN_VALUE
The smallest possible value. |
Constructor Summary | |
---|---|
Int16(byte[] word)
Creates a new instance from a byte array. |
|
Int16(int word)
Creates a new instance from an int . |
|
Int16(long word)
Creates a new instance from a long . |
|
Int16(short word)
Creates a new instance from a short . |
Method Summary | |
---|---|
Int16 |
addBitmask(Int16 bitmask)
Sets the bits in the given bitmask. |
Int16 |
and(Int16 number)
Logical and. |
int |
compareTo(java.lang.Object object)
Compares this Int16 to another Int16 for order. |
double |
doubleValue()
Gets the value as a double . |
boolean |
equals(java.lang.Object object)
Compares this Int16 to anoter Int16 for equality. |
float |
floatValue()
Gets the value as a float . |
boolean |
hasBitmask(Int16 bitmask)
Determines if this number has the given bitmask. |
int |
hashCode()
Gets the hash code. |
short |
int16Value()
Gets the value as an unsigned 16-bit integer. |
int |
intValue()
Gets the value as an int . |
long |
longValue()
Gets the value as a long . |
Int16 |
not()
Logical not. |
Int16 |
or(Int16 number)
Logical or. |
Int16 |
removeBitmask(Int16 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 . |
static Int16 |
valueOfBigEndian(byte[] word)
Creates a new instance from a byte array. |
static Int16 |
valueOfLittleEndian(byte[] word)
Creates a new instance from a byte array. |
Int16 |
xor(Int16 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 short MAX_VALUE
32767
public static final short MIN_VALUE
-32768
Constructor Detail |
---|
public Int16(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 Int16(short word)
short
.
word
- the value to be representedpublic Int16(int word)
int
.
word
- the value to be representedpublic Int16(long word)
long
.
word
- the value to be representedMethod Detail |
---|
public static Int16 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 Int16 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 short int16Value()
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)
Int16
to another Int16
for order.
compareTo
in interface java.lang.Comparable
object
- a Int16
public boolean equals(java.lang.Object object)
Int16
to anoter Int16
for equality.
equals
in class java.lang.Object
object
- a Int16
public int hashCode()
intValue()
.
hashCode
in class java.lang.Object
public java.lang.String toString()
String
.
toString
in class java.lang.Object
String
public Int16 and(Int16 number)
Bitwise
and
in interface Bitwise<Int16>
public Int16 not()
Bitwise
not
in interface Bitwise<Int16>
public Int16 or(Int16 number)
Bitwise
or
in interface Bitwise<Int16>
public Int16 xor(Int16 number)
Bitwise
xor
in interface Bitwise<Int16>
public Int16 addBitmask(Int16 bitmask)
Bitwise
addBitmask
in interface Bitwise<Int16>
public boolean hasBitmask(Int16 bitmask)
Bitwise
hasBitmask
in interface Bitwise<Int16>
true
if the number has the bitmask; false
otherwisepublic Int16 removeBitmask(Int16 bitmask)
Bitwise
removeBitmask
in interface Bitwise<Int16>
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |