public class SignedInteger extends Object implements Comparable<SignedInteger>
int
value). If the Integer class had not been declared final, this class would probably have extended it.
Signed integer objects are created by calling any of the static creation methods on this class.
Instances of this class are immutable.
UnsignedInteger,
SignedLong| Modifier and Type | Field and Description |
|---|---|
static SignedInteger |
ONE
This constant represents the value
1. |
static SignedInteger |
ZERO
This constant represents the value
0. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(SignedInteger l2) |
boolean |
equals(Object o) |
static SignedInteger |
fromBigEndianByteArray(byte[] barr)
Create a signed integer value from an four bytes long big-endian byte
array.
|
static SignedInteger |
fromLittleEndianByteArray(byte[] barr)
Create a signed integer value from an four bytes long little-endian byte
array.
|
byte[] |
getBigEndianByteArray()
Get the signed integer value represented as a big-endian byte array (four
bytes long).
|
byte[] |
getLittleEndianByteArray()
Get the signed integer value represented as a little-endian byte array
(four bytes long).
|
int |
hashCode() |
long |
intValue()
Get the signed integer value.
|
String |
toString() |
static SignedInteger |
valueOf(int value)
Create a new signed integer value.
|
public static final SignedInteger ZERO
0.public static final SignedInteger ONE
1.public static SignedInteger valueOf(int value)
value - The integer value.public long intValue()
public byte[] getBigEndianByteArray()
fromBigEndianByteArray(byte[]),
getLittleEndianByteArray()public static SignedInteger fromBigEndianByteArray(byte[] barr) throws IllegalArgumentException
barr - The byte array. It must be four bytes long.IllegalArgumentException - If the byte array is not four bytes
long.getBigEndianByteArray(),
fromLittleEndianByteArray(byte[])public byte[] getLittleEndianByteArray()
getBigEndianByteArray(),
fromBigEndianByteArray(byte[])public static SignedInteger fromLittleEndianByteArray(byte[] barr) throws IllegalArgumentException
barr - The byte array. It must be four bytes long.IllegalArgumentException - If the byte array is not four bytes
long.getLittleEndianByteArray(),
fromBigEndianByteArray(byte[])public int compareTo(SignedInteger l2)
compareTo in interface Comparable<SignedInteger>