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