public class BigIntegers
extends java.lang.Object
| Constructor and Description |
|---|
BigIntegers() |
| Modifier and Type | Method and Description |
|---|---|
static java.math.BigInteger |
fromBigEndianHexString(java.lang.String value)
Converts the integer in the given hex string to a BigInteger.
|
static java.math.BigInteger |
fromLittleEndianByteArray(byte[] value)
Converts the integer in the given byte array to a BigInteger.
|
static byte[] |
toLittleEndianByteArray(java.math.BigInteger value)
Gets the two's complement in little-endian order of the given integer.
|
static byte[] |
toLittleEndianByteArray(int value)
Gets the two's complement in little-endian order of the given integer.
|
static byte[] |
toLittleEndianByteArrayZeroPadded(java.math.BigInteger value,
int length)
Gets the two's complement in little-endian order of the given integer.
|
static byte[] |
toLittleEndianByteArrayZeroPadded(int value,
int minByteLength)
Gets the two's complement in little-endian order of the given integer.
|
public static byte[] toLittleEndianByteArray(java.math.BigInteger value)
Gets the two's complement in little-endian order of the given integer.
The resulting byte array is correct for usage e.g. in NEO VM scripts. The conversion behaves equally to the one used in the C#-based neo-vm implementation. It is basically how the BigIntger.toByteArray() in C# works (Cf. C# docs ).
value - The integer to convert.public static byte[] toLittleEndianByteArray(int value)
value - the integer to converttoLittleEndianByteArray(BigInteger)public static byte[] toLittleEndianByteArrayZeroPadded(java.math.BigInteger value,
int length)
value - The integer to convert.length - Desired length of the byte array.java.lang.IllegalArgumentException - if the length of the integer in bytes is bigger than the
given length.toLittleEndianByteArray(BigInteger)public static byte[] toLittleEndianByteArrayZeroPadded(int value,
int minByteLength)
value - the integer to convertminByteLength - Desired length of the byte array.java.lang.IllegalArgumentException - if the length of the integer in bytes is bigger than the
given minimum length.toLittleEndianByteArray(BigInteger)public static java.math.BigInteger fromLittleEndianByteArray(byte[] value)
value - The byte array to convert.public static java.math.BigInteger fromBigEndianHexString(java.lang.String value)
value - The byte array to convert.