public final class UInt256 extends java.lang.Object implements UInt256Value<UInt256>
UInt256Value - a 256-bit precision unsigned number of no particular unit.| Modifier and Type | Field and Description |
|---|---|
static UInt256 |
MAX_VALUE
The maximum value of a UInt256
|
static UInt256 |
MIN_VALUE
The minimum value of a UInt256
|
static UInt256 |
ONE
The value 1
|
static UInt256 |
ZERO
The value 0
|
| Modifier and Type | Method and Description |
|---|---|
UInt256 |
add(long value)
Returns a value that is
(this + value). |
UInt256 |
add(UInt256 value)
Returns a value that is
(this + value). |
UInt256 |
addMod(long value,
long modulus)
Returns a value equivalent to
((this + value) mod modulus). |
UInt256 |
addMod(long value,
UInt256 modulus)
Returns a value equivalent to
((this + value) mod modulus). |
UInt256 |
addMod(UInt256 value,
UInt256 modulus)
Returns a value equivalent to
((this + value) mod modulus). |
UInt256 |
and(Bytes32 bytes)
Return a bit-wise AND of this value and the supplied bytes.
|
UInt256 |
and(UInt256 value)
Return a bit-wise AND of this value and the supplied value.
|
int |
bitLength()
Provides the number of bits following and including the highest-order ("leftmost") one-bit in the binary
representation of this value, or zero if all bits are zero.
|
int |
compareTo(UInt256 other) |
UInt256 |
divide(long value)
Returns a value that is
(this / value). |
UInt256 |
divide(UInt256 value)
Returns a value that is
(this / value). |
UInt256 |
divideCeil(long value)
Returns a value that is
ceiling(this / value). |
UInt256 |
divideCeil(UInt256 value)
Returns a value that is
ceiling(this / value). |
boolean |
equals(java.lang.Object object) |
boolean |
fitsInt()
Returns true if the value can fit in an int.
|
boolean |
fitsLong()
Returns true if the value can fit in a long.
|
static UInt256 |
fromBytes(Bytes bytes)
Return a
UInt256 containing the value described by the specified bytes. |
static UInt256 |
fromHexString(java.lang.String str)
Parse a hexadecimal string into a
UInt256. |
int |
hashCode() |
int |
intValue()
Provides this value as an int.
|
boolean |
isZero()
Returns true is the value is 0.
|
UInt256 |
mod(long modulus)
Returns a value that is
(this mod modulus). |
UInt256 |
mod(UInt256 modulus)
Returns a value that is
(this mod modulus). |
UInt256 |
mod0(long modulus)
Returns a value that is
(this mod modulus), or 0 if modulus is 0. |
UInt256 |
mod0(UInt256 modulus)
Returns a value that is
(this mod modulus), or 0 if modulus is 0. |
UInt256 |
multiply(long value)
Returns a value that is
(this * value). |
UInt256 |
multiply(UInt256 value)
Returns a value that is
(this * value). |
UInt256 |
multiplyMod(long value,
long modulus)
Returns a value that is
((this * value) mod modulus). |
UInt256 |
multiplyMod(long value,
UInt256 modulus)
Returns a value that is
((this * value) mod modulus). |
UInt256 |
multiplyMod(UInt256 value,
UInt256 modulus)
Returns a value that is
((this * value) mod modulus). |
UInt256 |
not()
Return a bit-wise NOT of this value.
|
int |
numberOfLeadingZeros()
Provides the number of zero bits preceding the highest-order one-bit.
|
UInt256 |
or(Bytes32 bytes)
Return a bit-wise OR of this value and the supplied bytes.
|
UInt256 |
or(UInt256 value)
Return a bit-wise OR of this value and the supplied value.
|
UInt256 |
pow(long exponent)
Returns a value that is
(this<sup>exponent</sup> mod 2<sup>256</sup>) |
UInt256 |
pow(UInt256 exponent)
Returns a value that is
(this<sup>exponent</sup> mod 2<sup>256</sup>) |
UInt256 |
shiftLeft(int distance)
Shift all bits in this value to the left.
|
UInt256 |
shiftRight(int distance)
Shift all bits in this value to the right.
|
UInt256 |
subtract(long value)
Returns a value that is
(this - value). |
UInt256 |
subtract(UInt256 value)
Returns a value that is
(this - value). |
java.math.BigInteger |
toBigInteger()
Provides the value as a BigInteger.
|
Bytes32 |
toBytes()
Provides the value as bytes.
|
long |
toLong()
Provides the value as a long.
|
Bytes |
toMinimalBytes()
Provides the value as bytes without any leading zero bytes.
|
java.lang.String |
toString() |
UInt256 |
toUInt256()
Convert this value to a
UInt256. |
static UInt256 |
valueOf(java.math.BigInteger value)
Return a
UInt256 containing the specified value. |
static UInt256 |
valueOf(long value)
Return a
UInt256 containing the specified value. |
UInt256 |
xor(Bytes32 bytes)
Return a bit-wise XOR of this value and the supplied bytes.
|
UInt256 |
xor(UInt256 value)
Return a bit-wise XOR of this value and the supplied value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitaddExact, addExact, plus, plus, subtractExact, subtractExact, toHexString, toShortHexStringpublic static final UInt256 MIN_VALUE
public static final UInt256 MAX_VALUE
public static final UInt256 ZERO
public static final UInt256 ONE
public static UInt256 valueOf(long value)
UInt256 containing the specified value.value - The value to create a UInt256 for.UInt256 containing the specified value.java.lang.IllegalArgumentException - If the value is negative.public static UInt256 valueOf(java.math.BigInteger value)
UInt256 containing the specified value.public static UInt256 fromBytes(Bytes bytes)
UInt256 containing the value described by the specified bytes.public static UInt256 fromHexString(java.lang.String str)
UInt256.str - The hexadecimal string to parse, which may or may not start with "0x". That representation may contain
less than 32 bytes, in which case the result is left padded with zeros.str.java.lang.IllegalArgumentException - if str does not correspond to a valid hexadecimal representation or
contains more than 32 bytes.public boolean isZero()
UInt256ValueisZero in interface UInt256Value<UInt256>public UInt256 add(UInt256 value)
UInt256Value(this + value).add in interface UInt256Value<UInt256>value - The amount to be added to this value.this + valuepublic UInt256 add(long value)
UInt256Value(this + value).add in interface UInt256Value<UInt256>value - The amount to be added to this value.this + valuepublic UInt256 addMod(UInt256 value, UInt256 modulus)
UInt256Value((this + value) mod modulus).addMod in interface UInt256Value<UInt256>value - The amount to be added to this value.modulus - The modulus.(this + value) mod moduluspublic UInt256 addMod(long value, UInt256 modulus)
UInt256Value((this + value) mod modulus).addMod in interface UInt256Value<UInt256>value - The amount to be added to this value.modulus - The modulus.(this + value) mod moduluspublic UInt256 addMod(long value, long modulus)
UInt256Value((this + value) mod modulus).addMod in interface UInt256Value<UInt256>value - The amount to be added to this value.modulus - The modulus.(this + value) mod moduluspublic UInt256 subtract(UInt256 value)
UInt256Value(this - value).subtract in interface UInt256Value<UInt256>value - The amount to be subtracted from this value.this - valuepublic UInt256 subtract(long value)
UInt256Value(this - value).subtract in interface UInt256Value<UInt256>value - The amount to be subtracted from this value.this - valuepublic UInt256 multiply(UInt256 value)
UInt256Value(this * value).multiply in interface UInt256Value<UInt256>value - The amount to multiply this value by.this * valuepublic UInt256 multiply(long value)
UInt256Value(this * value).multiply in interface UInt256Value<UInt256>value - The amount to multiply this value by.this * valuepublic UInt256 multiplyMod(UInt256 value, UInt256 modulus)
UInt256Value((this * value) mod modulus).multiplyMod in interface UInt256Value<UInt256>value - The amount to multiply this value by.modulus - The modulus.(this * value) mod moduluspublic UInt256 multiplyMod(long value, UInt256 modulus)
UInt256Value((this * value) mod modulus).multiplyMod in interface UInt256Value<UInt256>value - The amount to multiply this value by.modulus - The modulus.(this * value) mod moduluspublic UInt256 multiplyMod(long value, long modulus)
UInt256Value((this * value) mod modulus).multiplyMod in interface UInt256Value<UInt256>value - The amount to multiply this value by.modulus - The modulus.(this * value) mod moduluspublic UInt256 divide(UInt256 value)
UInt256Value(this / value).divide in interface UInt256Value<UInt256>value - The amount to divide this value by.this / valuepublic UInt256 divide(long value)
UInt256Value(this / value).divide in interface UInt256Value<UInt256>value - The amount to divide this value by.this / valuepublic UInt256 divideCeil(UInt256 value)
UInt256Valueceiling(this / value).divideCeil in interface UInt256Value<UInt256>value - The amount to divide this value by.this / value + ( this % value == 0 ? 0 : 1)public UInt256 divideCeil(long value)
UInt256Valueceiling(this / value).divideCeil in interface UInt256Value<UInt256>value - The amount to divide this value by.this / value + ( this % value == 0 ? 0 : 1)public UInt256 pow(UInt256 exponent)
UInt256Value(this<sup>exponent</sup> mod 2<sup>256</sup>)
This calculates an exponentiation over the modulus of 2^256.
Note that exponent is an UInt256 rather than of the type T.
pow in interface UInt256Value<UInt256>exponent - The exponent to which this value is to be raised.this<sup>exponent</sup> mod 2<sup>256</sup>public UInt256 pow(long exponent)
UInt256Value(this<sup>exponent</sup> mod 2<sup>256</sup>)
This calculates an exponentiation over the modulus of 2^256.
pow in interface UInt256Value<UInt256>exponent - The exponent to which this value is to be raised.this<sup>exponent</sup> mod 2<sup>256</sup>public UInt256 mod(UInt256 modulus)
UInt256Value(this mod modulus).mod in interface UInt256Value<UInt256>modulus - The modulus.this mod modulus.public UInt256 mod(long modulus)
UInt256Value(this mod modulus).mod in interface UInt256Value<UInt256>modulus - The modulus.this mod modulus.public UInt256 mod0(UInt256 modulus)
UInt256Value(this mod modulus), or 0 if modulus is 0.mod0 in interface UInt256Value<UInt256>modulus - The modulus.this mod modulus.public UInt256 mod0(long modulus)
UInt256Value(this mod modulus), or 0 if modulus is 0.mod0 in interface UInt256Value<UInt256>modulus - The modulus.this mod modulus.public UInt256 and(UInt256 value)
value - the value to perform the operation withpublic UInt256 and(Bytes32 bytes)
bytes - the bytes to perform the operation withpublic UInt256 or(UInt256 value)
value - the value to perform the operation withpublic UInt256 or(Bytes32 bytes)
bytes - the bytes to perform the operation withpublic UInt256 xor(UInt256 value)
value - the value to perform the operation withpublic UInt256 xor(Bytes32 bytes)
bytes - the bytes to perform the operation withpublic UInt256 not()
public UInt256 shiftRight(int distance)
distance - The number of bits to shift by.public UInt256 shiftLeft(int distance)
distance - The number of bits to shift by.public boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(UInt256 other)
compareTo in interface java.lang.Comparable<UInt256>public boolean fitsInt()
UInt256ValuefitsInt in interface UInt256Value<UInt256>int (i.e. is less or equal to Integer.MAX_VALUE).public int intValue()
UInt256ValueintValue in interface UInt256Value<UInt256>int assuming it is small enough to fit an int.public boolean fitsLong()
UInt256ValuefitsLong in interface UInt256Value<UInt256>long (i.e. is less or equal to Long.MAX_VALUE).public long toLong()
UInt256ValuetoLong in interface UInt256Value<UInt256>long assuming it is small enough to fit a long.public java.lang.String toString()
toString in class java.lang.Objectpublic java.math.BigInteger toBigInteger()
UInt256ValuetoBigInteger in interface UInt256Value<UInt256>BigInteger.public UInt256 toUInt256()
UInt256ValueUInt256.toUInt256 in interface UInt256Value<UInt256>UInt256.public Bytes32 toBytes()
UInt256ValuetoBytes in interface UInt256Value<UInt256>public Bytes toMinimalBytes()
UInt256ValuetoMinimalBytes in interface UInt256Value<UInt256>public int numberOfLeadingZeros()
UInt256ValuenumberOfLeadingZeros in interface UInt256Value<UInt256>public int bitLength()
UInt256ValuebitLength in interface UInt256Value<UInt256>