public final class Number160 extends Number implements Comparable<Number160>
Modifier and Type | Field and Description |
---|---|
static int |
BITS |
static int |
BYTE_ARRAY_SIZE |
static int |
INT_ARRAY_SIZE |
static Number160 |
MAX_VALUE |
static Number160 |
ONE |
static Number160 |
ZERO |
Constructor and Description |
---|
Number160()
Create a Key with value 0.
|
Number160(byte[] val)
Creates a new Key using the byte array.
|
Number160(byte[] val,
int offset,
int length)
Creates a new Key using the byte array.
|
Number160(int... val)
Create an instance with an integer array.
|
Number160(int val)
Creates a Key with the integer value
|
Number160(long val) |
Number160(Random random)
Creates a new Key with random values in it.
|
Number160(ShortString shortString) |
Number160(String val)
Create a Key from a string.
|
Modifier and Type | Method and Description |
---|---|
int |
bitLength()
Calculates the number of bits used to represent this number.
|
int |
compareTo(Number160 o) |
static Number160 |
createHash(int integerValue)
Create a new Number160 from the integer, which fills all the 160bits.
|
static Number160 |
createHash(long longValue)
Create a new Number160 from the long, which fills all the 160bit.
|
static Number160 |
createHash(String string)
Create a new Number160 using SHA1 on the string.
|
double |
doubleValue() |
boolean |
equals(Object obj) |
float |
floatValue() |
int |
hashCode() |
int |
intValue() |
boolean |
isZero()
Checks if this number is zero
|
long |
longValue() |
Number160 |
shiftLeft(int nr)
Shift left the 160bit number.
|
Number160 |
shiftRight(int nr)
Shift right the 160bit number.
|
byte[] |
toByteArray()
Returns a byte array, which is always of size 20.
|
int |
toByteArray(byte[] me,
int offset)
Fills the byte array with this number
|
int[] |
toIntArray()
Returns a copy of the backing array, which is always of size 5.
|
String |
toString() |
String |
toString(boolean removeLeadingZero)
Shows the content in a human readable manner
|
long |
unsignedInt(int pos)
For debugging...
|
Number160 |
xor(Number160 key)
Xor operation.
|
byteValue, shortValue
public static final int BITS
public static final Number160 MAX_VALUE
public static final int INT_ARRAY_SIZE
public static final int BYTE_ARRAY_SIZE
public static final Number160 ZERO
public static final Number160 ONE
public Number160()
public Number160(ShortString shortString)
public Number160(int... val)
val
- The value to copy to the backing array. Since this class
stores 160bit numbers, the array needs to be of size 5 or
smaller.public Number160(String val)
val
- The characters allowed are [0-9a-f], which is in hexadecimalpublic Number160(int val)
val
- integer valuepublic Number160(long val)
public Number160(byte[] val)
val
- public Number160(byte[] val, int offset, int length)
val
- offset
- The offset where to startpublic Number160(Random random)
random
- The object to create pseudo random numbers. For testing and
debugging, the seed in the random class can be set to make the
random values repeatable.public Number160 xor(Number160 key)
key
- The second operand for the xor operationpublic Number160 shiftRight(int nr)
nr
- The number of bits to be shiftedpublic Number160 shiftLeft(int nr)
nr
- The number of bits to be shiftedpublic int[] toIntArray()
public int toByteArray(byte[] me, int offset)
me
- public byte[] toByteArray()
public String toString(boolean removeLeadingZero)
removeLeadingZero
- Indicates of leading zeros should be removedpublic boolean isZero()
public int bitLength()
public double doubleValue()
doubleValue
in class Number
public float floatValue()
floatValue
in class Number
public long unsignedInt(int pos)
pos
- public int compareTo(Number160 o)
compareTo
in interface Comparable<Number160>
public static Number160 createHash(int integerValue)
integerValue
- The value to hash frompublic static Number160 createHash(long longValue)
longValue
- The value to hash fromCopyright © 2013. All Rights Reserved.