Package org.polkadot.types.primitive
Class Int
- java.lang.Object
-
- java.lang.Number
-
- java.math.BigInteger
-
- org.polkadot.types.codec.AbstractInt
-
- org.polkadot.types.primitive.Int
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<java.math.BigInteger>,Codec
public class Int extends AbstractInt
A generic signed integer codec. For Substrate all numbers are LE encoded, this handles the encoding and decoding of those numbers. Upon construction the bitLength is provided and any additional use keeps the number to this length. This extends `BN`, so all methods available on a normal `BN` object is available here.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Int(java.lang.Object value, int bitLength, boolean isHexJson)
-
Method Summary
-
Methods inherited from class org.polkadot.types.codec.AbstractInt
bitLength, eq, getEncodedLength, isEmpty, toBn, toJson
-
Methods inherited from class java.math.BigInteger
abs, add, and, andNot, bitCount, byteValueExact, clearBit, compareTo, divide, divideAndRemainder, doubleValue, equals, flipBit, floatValue, gcd, getLowestSetBit, hashCode, intValue, intValueExact, isProbablePrime, longValue, longValueExact, max, min, mod, modInverse, modPow, multiply, negate, nextProbablePrime, not, or, pow, probablePrime, remainder, setBit, shiftLeft, shiftRight, shortValueExact, signum, sqrt, sqrtAndRemainder, subtract, testBit, toByteArray, toString, toString, valueOf, xor
-
-
-
-
Method Detail
-
toHex
public java.lang.String toHex()
Returns a hex string representation of the value- Specified by:
toHexin interfaceCodec- Specified by:
toHexin classAbstractInt
-
toU8a
public byte[] toU8a(boolean isBare)
- Specified by:
toU8ain interfaceCodec- Specified by:
toU8ain classAbstractInt- Parameters:
isBare- true when the value has none of the type-specific prefixes (internal) Encodes the value as a Uint8Array as per the parity-codec specifications
-
-