Class EInteger

  • All Implemented Interfaces:
    java.lang.Comparable<EInteger>

    public final class EInteger
    extends java.lang.Object
    implements java.lang.Comparable<EInteger>
    Represents an arbitrary-precision integer. (The "E" stands for "extended", and has this prefix to group it with the other classes common to this library, particularly EDecimal, EFloat, and ERational.)

    Instances of this class are immutable, so they are inherently safe for use by multiple threads. Multiple instances of this object with the same value are interchangeable, but they should be compared using the "Equals" method rather than the "==" operator.

    Security note

    It is not recommended to implement security-sensitive algorithms using the methods in this class, for several reasons:

    • EInteger objects are immutable, so they can't be modified, and the memory they occupy is not guaranteed to be cleared in a timely fashion due to garbage collection. This is relevant for applications that use many-bit-long numbers as secret parameters.
    • The methods in this class (especially those that involve arithmetic) are not guaranteed to be "constant-time" (non-data-dependent) for all relevant inputs. Certain attacks that involve encrypted communications have exploited the timing and other aspects of such communications to derive keying material or cleartext indirectly.

    Applications should instead use dedicated security libraries to handle big numbers in security-sensitive algorithms.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      EInteger Abs()
      Returns the absolute value of this object's value.
      EInteger Add​(int intValue)
      Adds this arbitrary-precision integer and a 32-bit signed integer and returns the result.
      EInteger Add​(long longValue)
      Adds this arbitrary-precision integer and a 64-bit signed integer and returns the result.
      EInteger Add​(EInteger bigintAugend)
      Adds this arbitrary-precision integer and another arbitrary-precision integer and returns the result.
      EInteger And​(EInteger other)
      Does an AND operation between this arbitrary-precision integer and another one.
      EInteger AndNot​(EInteger second)
      Does an AND NOT operation between this arbitrary-precision integer and another one.
      int AsInt32Checked()
      Deprecated.
      Renamed to ToInt32Checked.
      int AsInt32Unchecked()
      Deprecated.
      Renamed to ToInt32Unchecked.
      long AsInt64Checked()
      Deprecated.
      Renamed to ToInt64Checked.
      long AsInt64Unchecked()
      Deprecated.
      Renamed to ToInt64Unchecked.
      boolean CanFitInInt32()
      Returns whether this object's value can fit in a 32-bit signed integer.
      boolean CanFitInInt64()
      Returns whether this object's value can fit in a 64-bit signed integer.
      int compareTo​(int intValue)
      Compares an arbitrary-precision integer with this instance.
      int compareTo​(long longValue)
      Compares an arbitrary-precision integer with this instance.
      int compareTo​(EInteger other)
      Compares an arbitrary-precision integer with this instance.
      EInteger Decrement()
      Returns one subtracted from this arbitrary-precision integer.
      EInteger Divide​(int intValue)
      Divides this arbitrary-precision integer by a 32-bit signed integer and returns the result.
      EInteger Divide​(long longValue)
      Divides this arbitrary-precision integer by a 64-bit signed integer and returns the result.
      EInteger Divide​(EInteger bigintDivisor)
      Divides this arbitrary-precision integer by another arbitrary-precision integer and returns the result.
      EInteger[] DivRem​(int intDivisor)
      Divides this arbitrary-precision integer by a 32-bit signed integer and returns a two-item array containing the result of the division and the remainder, in that order.
      EInteger[] DivRem​(long intDivisor)
      Divides this arbitrary-precision integer by a 64-bit signed integer and returns a two-item array containing the result of the division and the remainder, in that order.
      EInteger[] DivRem​(EInteger divisor)
      Divides this arbitrary-precision integer by another arbitrary-precision integer and returns a two-item array containing the result of the division and the remainder, in that order.
      boolean equals​(java.lang.Object obj)
      Determines whether this object and another object are equal and have the same type.
      EInteger Eqv​(EInteger second)
      Does an XOR NOT operation (or equivalence operation, EQV operation, or exclusive-OR NOT operation) between this arbitrary-precision integer and another one.
      static EInteger FromBoolean​(boolean boolValue)
      Converts a boolean value (true or false) to an arbitrary-precision integer.
      static EInteger FromByte​(byte inputByte)
      Converts a byte (from 0 to 255) to an arbitrary-precision integer.
      static EInteger FromBytes​(byte[] bytes, boolean littleEndian)
      Initializes an arbitrary-precision integer from an array of bytes.
      static EInteger FromBytes​(byte[] bytes, int offset, int length, boolean littleEndian)
      Initializes an arbitrary-precision integer from a portion of an array of bytes.
      static EInteger FromInt16​(short inputInt16)
      Converts a 16-bit signed integer to an arbitrary-precision integer.
      static EInteger FromInt32​(int intValue)
      Converts a 32-bit signed integer to an arbitrary-precision integer.
      static EInteger FromInt64​(long longerValue)
      Converts a 64-bit signed integer to an arbitrary-precision integer.
      static EInteger FromInt64AsUnsigned​(long longerValue)
      Converts an unsigned integer expressed as a 64-bit signed integer to an arbitrary-precision integer.
      static EInteger FromRadixString​(byte[] bytes, int radix)
      Converts a sequence of bytes (interpreted as text) to an arbitrary-precision integer in a given radix.
      static EInteger FromRadixString​(char[] cs, int radix)
      Converts a sequence of char s to an arbitrary-precision integer in a given radix.
      static EInteger FromRadixString​(java.lang.String str, int radix)
      Converts a string to an arbitrary-precision integer in a given radix.
      static EInteger FromRadixSubstring​(byte[] bytes, int radix, int index, int endIndex)
      Converts a portion of a sequence of bytes (interpreted as text) to an arbitrary-precision integer in a given radix.
      static EInteger FromRadixSubstring​(char[] cs, int radix, int index, int endIndex)
      Converts a portion of a sequence of char s to an arbitrary-precision integer in a given radix.
      static EInteger FromRadixSubstring​(java.lang.String str, int radix, int index, int endIndex)
      Converts a portion of a string to an arbitrary-precision integer in a given radix.
      static EInteger FromString​(byte[] bytes)
      Converts a sequence of bytes (interpreted as text) to an arbitrary-precision integer.
      static EInteger FromString​(char[] cs)
      Converts a sequence of char s to an arbitrary-precision integer.
      static EInteger FromString​(java.lang.String str)
      Converts a string to an arbitrary-precision integer.
      static EInteger FromSubstring​(byte[] bytes, int index, int endIndex)
      Converts a portion of a sequence of bytes (interpreted as text) to an arbitrary-precision integer.
      static EInteger FromSubstring​(char[] cs, int index, int endIndex)
      Converts a portion of a sequence of char s to an arbitrary-precision integer.
      static EInteger FromSubstring​(java.lang.String str, int index, int endIndex)
      Converts a portion of a string to an arbitrary-precision integer.
      EInteger Gcd​(EInteger bigintSecond)
      Returns the greatest common divisor of this integer and the given integer.
      int GetDigitCount()
      Deprecated.
      This method may overflow.
      EInteger GetDigitCountAsEInteger()
      Returns the number of decimal digits used by this integer, in the form of an arbitrary-precision integer.
      long GetDigitCountAsInt64()
      Returns the number of decimal digits used by this integer, in the form of a 64-bit signed integer.
      int GetLowBit()
      Deprecated.
      This method may overflow.
      EInteger GetLowBitAsEInteger()
      Gets the bit position of the lowest set bit in this number's absolute value, in the form of an arbitrary-precision integer.
      long GetLowBitAsInt64()
      Gets the bit position of the lowest set bit in this number's absolute value, in the form of a 64-bit signed integer.
      static EInteger getOne()
      Gets the number 1 as an arbitrary-precision integer.
      boolean GetSignedBit​(int index)
      Returns whether a bit is set in the two's-complement form (see "Forms of numbers") of this object's value.
      boolean GetSignedBit​(EInteger bigIndex)
      Returns whether a bit is set in the two's-complement form (see "Forms of numbers") of this object's value.
      int GetSignedBitLength()
      Deprecated.
      This method may overflow.
      EInteger GetSignedBitLengthAsEInteger()
      Finds the minimum number of bits needed to represent this object's value, except for its sign, and returns that number of bits as an arbitrary-precision integer.
      long GetSignedBitLengthAsInt64()
      Finds the minimum number of bits needed to represent this object's value, except for its sign, and returns that number of bits as a 64-bit signed integer.
      static EInteger getTen()
      Gets the number 10 as an arbitrary-precision integer.
      boolean GetUnsignedBit​(int index)
      Returns whether a bit is set in this number's absolute value.
      boolean GetUnsignedBit​(EInteger bigIndex)
      Returns whether a bit is set in this number's absolute value.
      int GetUnsignedBitLength()
      Deprecated.
      This method may overflow.
      EInteger GetUnsignedBitLengthAsEInteger()
      Finds the minimum number of bits needed to represent this number's absolute value, and returns that number of bits as an arbitrary-precision integer.
      long GetUnsignedBitLengthAsInt64()
      Finds the minimum number of bits needed to represent this number's absolute value, and returns that number of bits as a 64-bit signed integer.
      static EInteger getZero()
      Gets the number zero as an arbitrary-precision integer.
      int hashCode()
      Returns the hash code for this instance.
      EInteger Imp​(EInteger second)
      Does an OR NOT operation between this arbitrary-precision integer and another one.
      EInteger Increment()
      Returns one added to this arbitrary-precision integer.
      boolean isEven()
      Gets a value indicating whether this value is even.
      boolean isPowerOfTwo()
      Gets a value indicating whether this object's value is a power of two, and greater than 0.
      boolean isZero()
      Gets a value indicating whether this value is 0.
      EInteger LowBits​(int bitCount)
      Extracts the lowest bits of this integer.
      EInteger LowBits​(long longBitCount)
      Extracts the lowest bits of this integer.
      EInteger LowBits​(EInteger bigBitCount)
      Extracts the lowest bits of this integer.
      static EInteger Max​(EInteger first, EInteger second)
      Returns the greater of two arbitrary-precision integers.
      static EInteger MaxMagnitude​(EInteger first, EInteger second)
      Of two arbitrary-precision integers, returns the one with the greater absolute value.
      static EInteger Min​(EInteger first, EInteger second)
      Returns the smaller of two arbitrary-precision integers.
      static EInteger MinMagnitude​(EInteger first, EInteger second)
      Of two arbitrary-precision integers, returns the one with the smaller absolute value.
      EInteger Mod​(int smallDivisor)
      Finds the modulus remainder that results when this instance is divided by the value of another integer.
      EInteger Mod​(EInteger divisor)
      Finds the modulus remainder that results when this instance is divided by the value of an arbitrary-precision integer.
      EInteger ModPow​(EInteger pow, EInteger mod)
      Calculates the remainder when this arbitrary-precision integer raised to a certain power is divided by another arbitrary-precision integer.
      EInteger Multiply​(int intValue)
      Multiplies this arbitrary-precision integer by a 32-bit signed integer and returns the result.
      EInteger Multiply​(long longValue)
      Multiplies this arbitrary-precision integer by a 64-bit signed integer and returns the result.
      EInteger Multiply​(EInteger bigintMult)
      Multiplies this arbitrary-precision integer by another arbitrary-precision integer and returns the result.
      EInteger Negate()
      Gets the value of this object with the sign reversed.
      EInteger Not()
      Returns an arbitrary-precision integer with every bit flipped from this one (also called an inversion or NOT operation).
      EInteger Or​(EInteger second)
      Does an OR operation between this arbitrary-precision integer and another one.
      EInteger OrNot​(EInteger second)
      Does an OR NOT operation between this arbitrary-precision integer and another one.
      EInteger Pow​(int powerSmall)
      Raises an arbitrary-precision integer to a power.
      EInteger Pow​(long longPower)
      Raises an arbitrary-precision integer to a power.
      EInteger Pow​(EInteger bigPower)
      Raises an arbitrary-precision integer to a power.
      EInteger PowBigIntVar​(EInteger power)
      Deprecated.
      Use Pow instead.
      EInteger Remainder​(int intValue)
      Returns the remainder that would result when this arbitrary-precision integer is divided by a 32-bit signed integer.
      EInteger Remainder​(long longValue)
      Returns the remainder that would result when this arbitrary-precision integer is divided by a 64-bit signed integer.
      EInteger Remainder​(EInteger divisor)
      Returns the remainder that would result when this arbitrary-precision integer is divided by another arbitrary-precision integer.
      EInteger Root​(int root)
      Finds the nth root of this instance's value, rounded down.
      EInteger Root​(EInteger root)
      Finds the nth root of this instance's value, rounded down.
      EInteger[] RootRem​(int root)
      Calculates the nth root and the remainder.
      EInteger[] RootRem​(EInteger root)
      Calculates the nth root and the remainder.
      EInteger ShiftLeft​(int numberBits)
      Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits.
      EInteger ShiftLeft​(EInteger eshift)
      Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits given as an arbitrary-precision integer.
      EInteger ShiftRight​(int numberBits)
      Returns an arbitrary-precision integer with the bits shifted to the right.
      EInteger ShiftRight​(EInteger eshift)
      Returns an arbitrary-precision integer with the bits shifted to the right.
      int signum()
      Gets the sign of this object's value.
      EInteger Sqrt()
      Finds the square root of this instance's value, rounded down.
      EInteger[] SqrtRem()
      Calculates the square root and the remainder.
      EInteger Subtract​(int intValue)
      Subtracts a 32-bit signed integer from this arbitrary-precision integer and returns the result.
      EInteger Subtract​(long longValue)
      Subtracts a 64-bit signed integer from this arbitrary-precision integer and returns the result.
      EInteger Subtract​(EInteger subtrahend)
      Subtracts an arbitrary-precision integer from this arbitrary-precision integer and returns the result.
      byte ToByteChecked()
      Converts this number's value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255).
      byte[] ToBytes​(boolean littleEndian)
      Returns a byte array of this integer's value.
      byte ToByteUnchecked()
      Converts this number to a byte (from 0 to 255), returning the least-significant bits of this number's two's-complement form.
      short ToInt16Checked()
      Converts this number's value to a 16-bit signed integer if it can fit in a 16-bit signed integer.
      short ToInt16Unchecked()
      Converts this number to a 16-bit signed integer, returning the least-significant bits of this number's two's-complement form.
      int ToInt32Checked()
      Converts this object's value to a 32-bit signed integer, throwing an exception if it can't fit.
      int ToInt32Unchecked()
      Converts this object's value to a 32-bit signed integer.
      long ToInt64Checked()
      Converts this object's value to a 64-bit signed integer, throwing an exception if it can't fit.
      long ToInt64Unchecked()
      Converts this object's value to a 64-bit signed integer.
      java.lang.String ToRadixString​(int radix)
      Generates a string representing the value of this object, in the given radix.
      java.lang.String toString()
      Converts this object to a text string in base 10.
      EInteger Xor​(EInteger other)
      Does an exclusive OR (XOR) operation between this arbitrary-precision integer and another one.
      EInteger XorNot​(EInteger second)
      Does an XOR NOT operation (or equivalence operation, EQV operation, or exclusive-OR NOT operation) between this arbitrary-precision integer and another one.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getOne

        public static EInteger getOne()
        Gets the number 1 as an arbitrary-precision integer.
        Returns:
        The number 1 as an arbitrary-precision integer.
      • getTen

        public static EInteger getTen()
        Gets the number 10 as an arbitrary-precision integer.
        Returns:
        The number 10 as an arbitrary-precision integer.
      • getZero

        public static EInteger getZero()
        Gets the number zero as an arbitrary-precision integer.
        Returns:
        The number zero as an arbitrary-precision integer.
      • isEven

        public final boolean isEven()
        Gets a value indicating whether this value is even.
        Returns:
        true if this value is even; otherwise, false.
      • isPowerOfTwo

        public final boolean isPowerOfTwo()
        Gets a value indicating whether this object's value is a power of two, and greater than 0.
        Returns:
        true if this object's value is a power of two, and greater than 0; otherwise, false.
      • isZero

        public final boolean isZero()
        Gets a value indicating whether this value is 0.
        Returns:
        true if this value is 0; otherwise, false.
      • signum

        public final int signum()
        Gets the sign of this object's value.
        Returns:
        The sign of this object's value.
      • FromBytes

        public static EInteger FromBytes​(byte[] bytes,
                                         boolean littleEndian)
        Initializes an arbitrary-precision integer from an array of bytes.
        Parameters:
        bytes - A byte array consisting of the two's-complement form (see "Forms of numbers") of the arbitrary-precision integer to create. The byte array is encoded using the rules given in the FromBytes(bytes, offset, length, littleEndian) overload.
        littleEndian - If true, the byte order is little-endian, or least-significant-byte first. If false, the byte order is big-endian, or most-significant-byte first.
        Returns:
        An arbitrary-precision integer. Returns 0 if the byte array's length is 0.
        Throws:
        java.lang.NullPointerException - The parameter bytes is null.
      • FromBytes

        public static EInteger FromBytes​(byte[] bytes,
                                         int offset,
                                         int length,
                                         boolean littleEndian)
        Initializes an arbitrary-precision integer from a portion of an array of bytes. The portion of the byte array is encoded using the following rules:
        • Positive numbers have the first byte's highest bit cleared, and negative numbers have the bit set.
        • The last byte contains the lowest 8-bits, the next-to-last contains the next lowest 8 bits, and so on. For example, the number 300 can be encoded as 0x01, 0x2C and 200 as 0x00, 0xC8. (Note that the second example contains a set high bit in 0xC8, so an additional 0 is added at the start to ensure it's interpreted as positive.)
        • To encode negative numbers, take the absolute value of the number, subtract by 1, encode the number into bytes, and toggle each bit of each byte. Any further bits that appear beyond the most significant bit of the number will be all ones. For example, the number -450 can be encoded as 0xfe, 0x70 and -52869 as 0xff, 0x31, 0x7B. (Note that the second example contains a cleared high bit in 0x31, 0x7B, so an additional 0xff is added at the start to ensure it's interpreted as negative.)

        For little-endian, the byte order is reversed from the byte order just discussed.

        Parameters:
        bytes - A byte array consisting of the two's-complement form (see "Forms of numbers") of the arbitrary-precision integer to create. The byte array is encoded using the rules given in the FromBytes(bytes, offset, length, littleEndian) overload.
        offset - An index starting at 0 showing where the desired portion of bytes begins.
        length - The length, in bytes, of the desired portion of bytes (but not more than bytes 's length).
        littleEndian - If true, the byte order is little-endian, or least-significant-byte first. If false, the byte order is big-endian, or most-significant-byte first.
        Returns:
        An arbitrary-precision integer. Returns 0 if the byte array's length is 0.
        Throws:
        java.lang.NullPointerException - The parameter bytes is null.
        java.lang.IllegalArgumentException - Either offset or length is less than 0 or greater than bytes 's length, or bytes 's length minus offset is less than length.
      • FromBoolean

        public static EInteger FromBoolean​(boolean boolValue)
        Converts a boolean value (true or false) to an arbitrary-precision integer.
        Parameters:
        boolValue - Either true or false.
        Returns:
        The number 1 if boolValue is true; otherwise, 0.
      • FromInt32

        public static EInteger FromInt32​(int intValue)
        Converts a 32-bit signed integer to an arbitrary-precision integer.
        Parameters:
        intValue - The parameter intValue is a 32-bit signed integer.
        Returns:
        An arbitrary-precision integer with the same value as the 64-bit number.
      • FromInt64AsUnsigned

        public static EInteger FromInt64AsUnsigned​(long longerValue)
        Converts an unsigned integer expressed as a 64-bit signed integer to an arbitrary-precision integer.
        Parameters:
        longerValue - A 64-bit signed integer. If this value is 0 or greater, the return value will represent it. If this value is less than 0, the return value will store 2^64 plus this value instead.
        Returns:
        An arbitrary-precision integer. If longerValue is 0 or greater, the return value will represent it. If longerValue is less than 0, the return value will store 2^64 plus this value instead.
      • FromInt64

        public static EInteger FromInt64​(long longerValue)
        Converts a 64-bit signed integer to an arbitrary-precision integer.
        Parameters:
        longerValue - The parameter longerValue is a 64-bit signed integer.
        Returns:
        An arbitrary-precision integer with the same value as the 64-bit number.
      • FromRadixString

        public static EInteger FromRadixString​(java.lang.String str,
                                               int radix)
        Converts a string to an arbitrary-precision integer in a given radix.
        Parameters:
        str - A string described by the FromRadixSubstring method.
        radix - A base from 2 to 36. Depending on the radix, the string can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic upper-case letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic upper-case letter A to Z is allowed in the string, the corresponding basic lower-case letter (U+0061 to U+007a) is allowed instead.
        Returns:
        An arbitrary-precision integer with the same value as the given string.
        Throws:
        java.lang.NullPointerException - The parameter str is null.
        java.lang.NumberFormatException - The string is empty or in an invalid format.
      • FromRadixSubstring

        public static EInteger FromRadixSubstring​(java.lang.String str,
                                                  int radix,
                                                  int index,
                                                  int endIndex)
        Converts a portion of a string to an arbitrary-precision integer in a given radix.
        Parameters:
        str - A text string. The desired portion of the string must contain only characters allowed by the given radix, except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
        radix - A base from 2 to 36. Depending on the radix, the string can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic upper-case letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic upper-case letter A to Z is allowed in the string, the corresponding basic lower-case letter (U+0061 to U+007a) is allowed instead.
        index - The index of the string that starts the string portion.
        endIndex - The index of the string that ends the string portion. The length will be index + endIndex - 1.
        Returns:
        An arbitrary-precision integer with the same value as given in the string portion.
        Throws:
        java.lang.NullPointerException - The parameter str is null.
        java.lang.NumberFormatException - The string portion is empty or in an invalid format.
      • FromSubstring

        public static EInteger FromSubstring​(char[] cs,
                                             int index,
                                             int endIndex)
        Converts a portion of a sequence of char s to an arbitrary-precision integer.
        Parameters:
        cs - A sequence of char s, the desired portion of which describes an integer in base-10 (decimal) form. The desired portion of the sequence of char s must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
        index - The index of the sequence of char s that starts the desired portion.
        endIndex - The index of the sequence of char s that ends the desired portion. The length will be index + endIndex - 1.
        Returns:
        An arbitrary-precision integer with the same value as given in the sequence of char s portion.
        Throws:
        java.lang.IllegalArgumentException - The parameter index is less than 0, endIndex is less than 0, or either is greater than the sequence's length, or endIndex is less than index.
        java.lang.NullPointerException - The parameter cs is null.
      • FromString

        public static EInteger FromString​(char[] cs)
        Converts a sequence of char s to an arbitrary-precision integer.
        Parameters:
        cs - A sequence of char s describing an integer in base-10 (decimal) form. The sequence must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The sequence is not allowed to contain white space characters, including spaces. The sequence may start with any number of zeros.
        Returns:
        An arbitrary-precision integer with the same value as given in the sequence of char s.
        Throws:
        java.lang.NumberFormatException - The parameter cs is in an invalid format.
        java.lang.NullPointerException - The parameter cs is null.
      • FromRadixString

        public static EInteger FromRadixString​(char[] cs,
                                               int radix)
        Converts a sequence of char s to an arbitrary-precision integer in a given radix.
        Parameters:
        cs - A sequence of char s described by the FromRadixSubstring method.
        radix - A base from 2 to 36. Depending on the radix, the sequence of char s can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic upper-case letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic upper-case letter A to Z is allowed in the sequence of char s, the corresponding basic lower-case letter (U+0061 to U+007a) is allowed instead.
        Returns:
        An arbitrary-precision integer with the same value as the given sequence of char s.
        Throws:
        java.lang.NullPointerException - The parameter cs is null.
        java.lang.NumberFormatException - The sequence of char s is empty or in an invalid format.
      • FromRadixSubstring

        public static EInteger FromRadixSubstring​(char[] cs,
                                                  int radix,
                                                  int index,
                                                  int endIndex)
        Converts a portion of a sequence of char s to an arbitrary-precision integer in a given radix.
        Parameters:
        cs - A text sequence of char s. The desired portion of the sequence of char s must contain only characters allowed by the given radix, except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
        radix - A base from 2 to 36. Depending on the radix, the sequence of char s can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic upper-case letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic upper-case letter A to Z is allowed in the sequence of char s, the corresponding basic lower-case letter (U+0061 to U+007a) is allowed instead.
        index - The index of the sequence of char s that starts the desired portion.
        endIndex - The index of the sequence of char s that ends the desired portion. The length will be index + endIndex - 1.
        Returns:
        An arbitrary-precision integer with the same value as given in the sequence's portion.
        Throws:
        java.lang.NullPointerException - The parameter cs is null.
        java.lang.NumberFormatException - The portion is empty or in an invalid format.
      • FromSubstring

        public static EInteger FromSubstring​(byte[] bytes,
                                             int index,
                                             int endIndex)
        Converts a portion of a sequence of bytes (interpreted as text) to an arbitrary-precision integer. Each byte in the sequence has to be a character in the Basic Latin range (0x00 to 0x7f or U+0000 to U+007F) of the Unicode Standard.
        Parameters:
        bytes - A sequence of bytes (interpreted as text), the desired portion of which describes an integer in base-10 (decimal) form. The desired portion of the sequence of bytes (interpreted as text) must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
        index - The index of the sequence of bytes (interpreted as text) that starts the desired portion.
        endIndex - The index of the sequence of bytes (interpreted as text) that ends the desired portion. The length will be index + endIndex - 1.
        Returns:
        An arbitrary-precision integer with the same value as given in the sequence of bytes (interpreted as text) portion.
        Throws:
        java.lang.IllegalArgumentException - The parameter index is less than 0, endIndex is less than 0, or either is greater than the sequence's length, or endIndex is less than index.
        java.lang.NullPointerException - The parameter bytes is null.
      • FromString

        public static EInteger FromString​(byte[] bytes)
        Converts a sequence of bytes (interpreted as text) to an arbitrary-precision integer. Each byte in the sequence has to be a code point in the Basic Latin range (0x00 to 0x7f or U+0000 to U+007F) of the Unicode Standard.
        Parameters:
        bytes - A sequence of bytes describing an integer in base-10 (decimal) form. The sequence must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The sequence is not allowed to contain white space characters, including spaces. The sequence may start with any number of zeros.
        Returns:
        An arbitrary-precision integer with the same value as given in the sequence of bytes.
        Throws:
        java.lang.NumberFormatException - The parameter bytes is in an invalid format.
        java.lang.NullPointerException - The parameter bytes is null.
      • FromRadixString

        public static EInteger FromRadixString​(byte[] bytes,
                                               int radix)
        Converts a sequence of bytes (interpreted as text) to an arbitrary-precision integer in a given radix. Each byte in the sequence has to be a character in the Basic Latin range (0x00 to 0x7f or U+0000 to U+007F) of the Unicode Standard.
        Parameters:
        bytes - A sequence of bytes (interpreted as text) described by the FromRadixSubstring method.
        radix - A base from 2 to 36. Depending on the radix, the sequence of bytes can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic upper-case letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic upper-case letter A to Z is allowed in the sequence of bytes, the corresponding basic lower-case letter (U+0061 to U+007a) is allowed instead.
        Returns:
        An arbitrary-precision integer with the same value as the given sequence of bytes.
        Throws:
        java.lang.NullPointerException - The parameter bytes is null.
        java.lang.NumberFormatException - The sequence of bytes (interpreted as text) is empty or in an invalid format.
      • FromRadixSubstring

        public static EInteger FromRadixSubstring​(byte[] bytes,
                                                  int radix,
                                                  int index,
                                                  int endIndex)
        Converts a portion of a sequence of bytes (interpreted as text) to an arbitrary-precision integer in a given radix. Each byte in the sequence has to be a character in the Basic Latin range (0x00 to 0x7f or U+0000 to U+007F) of the Unicode Standard.
        Parameters:
        bytes - A sequence of bytes (interpreted as text). The desired portion of the sequence of bytes (interpreted as text) must contain only characters allowed by the given radix, except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
        radix - A base from 2 to 36. Depending on the radix, the sequence of bytes (interpreted as text) can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic upper-case letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic upper-case letter A to Z is allowed in the sequence of bytes (interpreted as text), the corresponding basic lower-case letter (U+0061 to U+007a) is allowed instead.
        index - The index of the sequence of bytes (interpreted as text) that starts the desired portion.
        endIndex - The index of the sequence of bytes (interpreted as text) that ends the desired portion. The length will be index + endIndex - 1.
        Returns:
        An arbitrary-precision integer with the same value as given in the sequence's portion.
        Throws:
        java.lang.NullPointerException - The parameter bytes is null.
        java.lang.NumberFormatException - The portion is empty or in an invalid format.
      • FromString

        public static EInteger FromString​(java.lang.String str)
        Converts a string to an arbitrary-precision integer.
        Parameters:
        str - A text string describing an integer in base-10 (decimal) form. The string must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The string is not allowed to contain white space characters, including spaces. The string may start with any number of zeros.
        Returns:
        An arbitrary-precision integer with the same value as given in the string.
        Throws:
        java.lang.NumberFormatException - The parameter str is in an invalid format.
        java.lang.NullPointerException - The parameter str is null.
      • FromSubstring

        public static EInteger FromSubstring​(java.lang.String str,
                                             int index,
                                             int endIndex)
        Converts a portion of a string to an arbitrary-precision integer.
        Parameters:
        str - A text string, the desired portion of which describes an integer in base-10 (decimal) form. The desired portion of the string must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign ("-", U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
        index - The index of the string that starts the string portion.
        endIndex - The index of the string that ends the string portion. The length will be index + endIndex - 1.
        Returns:
        An arbitrary-precision integer with the same value as given in the string portion.
        Throws:
        java.lang.IllegalArgumentException - The parameter index is less than 0, endIndex is less than 0, or either is greater than the string's length, or endIndex is less than index.
        java.lang.NullPointerException - The parameter str is null.
      • Abs

        public EInteger Abs()
        Returns the absolute value of this object's value.
        Returns:
        This object's value with the sign removed.
      • Add

        public EInteger Add​(EInteger bigintAugend)
        Adds this arbitrary-precision integer and another arbitrary-precision integer and returns the result.
        Parameters:
        bigintAugend - Another arbitrary-precision integer.
        Returns:
        The sum of the two numbers, that is, this arbitrary-precision integer plus another arbitrary-precision integer.
        Throws:
        java.lang.NullPointerException - The parameter bigintAugend is null.
      • AsInt32Checked

        @Deprecated
        public int AsInt32Checked()
        Deprecated.
        Renamed to ToInt32Checked.
        Converts this object's value to a 32-bit signed integer, throwing an exception if it can't fit.
        Returns:
        A 32-bit signed integer.
      • AsInt32Unchecked

        @Deprecated
        public int AsInt32Unchecked()
        Deprecated.
        Renamed to ToInt32Unchecked.
        Converts this object's value to a 32-bit signed integer. If the value can't fit in a 32-bit integer, returns the lower 32 bits of this object's two's-complement form (see "Forms of numbers") (in which case the return value might have a different sign than this object's value).
        Returns:
        A 32-bit signed integer.
      • AsInt64Checked

        @Deprecated
        public long AsInt64Checked()
        Deprecated.
        Renamed to ToInt64Checked.
        Converts this object's value to a 64-bit signed integer, throwing an exception if it can't fit.
        Returns:
        A 64-bit signed integer.
      • AsInt64Unchecked

        @Deprecated
        public long AsInt64Unchecked()
        Deprecated.
        Renamed to ToInt64Unchecked.
        Converts this object's value to a 64-bit signed integer. If the value can't fit in a 64-bit integer, returns the lower 64 bits of this object's two's-complement form (see "Forms of numbers") (in which case the return value might have a different sign than this object's value).
        Returns:
        A 64-bit signed integer.
      • CanFitInInt32

        public boolean CanFitInInt32()
        Returns whether this object's value can fit in a 32-bit signed integer.
        Returns:
        true if this object's value is from -2147483648 through 2147483647; otherwise, false.
      • CanFitInInt64

        public boolean CanFitInInt64()
        Returns whether this object's value can fit in a 64-bit signed integer.
        Returns:
        true if this object's value is from -9223372036854775808 through 9223372036854775807; otherwise, false.
      • compareTo

        public int compareTo​(EInteger other)
        Compares an arbitrary-precision integer with this instance.
        Specified by:
        compareTo in interface java.lang.Comparable<EInteger>
        Parameters:
        other - The integer to compare to this value.
        Returns:
        Zero if the values are equal; a negative number if this instance is less, or a positive number if this instance is greater. This implementation returns a positive number if.
      • Max

        public static EInteger Max​(EInteger first,
                                   EInteger second)
        Returns the greater of two arbitrary-precision integers.
        Parameters:
        first - The first integer to compare.
        second - The second integer to compare.
        Returns:
        The greater of the two integers.
        Throws:
        java.lang.NullPointerException - The parameter first or second is null.
      • Min

        public static EInteger Min​(EInteger first,
                                   EInteger second)
        Returns the smaller of two arbitrary-precision integers.
        Parameters:
        first - The first integer to compare.
        second - The second integer to compare.
        Returns:
        The smaller of the two integers.
        Throws:
        java.lang.NullPointerException - The parameter first or second is null.
      • MaxMagnitude

        public static EInteger MaxMagnitude​(EInteger first,
                                            EInteger second)
        Of two arbitrary-precision integers, returns the one with the greater absolute value. If both integers have the same absolute value, this method has the same effect as Max.
        Parameters:
        first - The first integer to compare.
        second - The second integer to compare.
        Returns:
        The integer with the greater absolute value.
        Throws:
        java.lang.NullPointerException - The parameter first or second is null.
      • MinMagnitude

        public static EInteger MinMagnitude​(EInteger first,
                                            EInteger second)
        Of two arbitrary-precision integers, returns the one with the smaller absolute value. If both integers have the same absolute value, this method has the same effect as Min.
        Parameters:
        first - The first integer to compare.
        second - The second integer to compare.
        Returns:
        The integer with the smaller absolute value.
        Throws:
        java.lang.NullPointerException - The parameter first or second is null.
      • Add

        public EInteger Add​(int intValue)
        Adds this arbitrary-precision integer and a 32-bit signed integer and returns the result.
        Parameters:
        intValue - The parameter intValue is a 32-bit signed integer.
        Returns:
        The sum of the two numbers, that is, this arbitrary-precision integer plus a 32-bit signed integer.
      • Subtract

        public EInteger Subtract​(int intValue)
        Subtracts a 32-bit signed integer from this arbitrary-precision integer and returns the result.
        Parameters:
        intValue - The parameter intValue is a 32-bit signed integer.
        Returns:
        The difference between the two numbers, that is, this arbitrary-precision integer minus a 32-bit signed integer.
      • Multiply

        public EInteger Multiply​(int intValue)
        Multiplies this arbitrary-precision integer by a 32-bit signed integer and returns the result.

        EInteger result = EInteger.FromString("5").Multiply(200);
        .

        Parameters:
        intValue - The parameter intValue is a 32-bit signed integer.
        Returns:
        The product of the two numbers, that is, this arbitrary-precision integer times a 32-bit signed integer.
      • Divide

        public EInteger Divide​(int intValue)
        Divides this arbitrary-precision integer by a 32-bit signed integer and returns the result. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 32-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative.
        Parameters:
        intValue - The divisor.
        Returns:
        The result of dividing this arbitrary-precision integer by a 32-bit signed integer. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 32-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative.
        Throws:
        java.lang.ArithmeticException - Attempted to divide by zero.
      • Remainder

        public EInteger Remainder​(int intValue)
        Returns the remainder that would result when this arbitrary-precision integer is divided by a 32-bit signed integer. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other 32-bit signed integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
        Parameters:
        intValue - The parameter intValue is a 32-bit signed integer.
        Returns:
        The remainder that would result when this arbitrary-precision integer is divided by a 32-bit signed integer.
        Throws:
        java.lang.ArithmeticException - Attempted to divide by zero.
        java.lang.NullPointerException - The parameter intValue is null.
      • compareTo

        public int compareTo​(int intValue)
        Compares an arbitrary-precision integer with this instance.
        Parameters:
        intValue - The parameter intValue is a 32-bit signed integer.
        Returns:
        Zero if the values are equal; a negative number if this instance is less, or a positive number if this instance is greater.
      • Divide

        public EInteger Divide​(EInteger bigintDivisor)
        Divides this arbitrary-precision integer by another arbitrary-precision integer and returns the result. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other arbitrary-precision integer is negative, or vice versa, and will be positive if both are positive or both are negative.
        Parameters:
        bigintDivisor - The divisor.
        Returns:
        The result of dividing this arbitrary-precision integer by another arbitrary-precision integer. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other arbitrary-precision integer is negative, or vice versa, and will be positive if both are positive or both are negative.
        Throws:
        java.lang.NullPointerException - The parameter bigintDivisor is null.
        java.lang.ArithmeticException - Attempted to divide by zero.
      • DivRem

        public EInteger[] DivRem​(int intDivisor)
        Divides this arbitrary-precision integer by a 32-bit signed integer and returns a two-item array containing the result of the division and the remainder, in that order. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 32-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other 32-bit signed integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
        Parameters:
        intDivisor - The number to divide by.
        Returns:
        An array of two items: the first is the result of the division as an arbitrary-precision integer, and the second is the remainder as an arbitrary-precision integer. The result of division is the result of the Divide method on the two operands, and the remainder is the result of the Remainder method on the two operands.
        Throws:
        java.lang.ArithmeticException - The parameter intDivisor is 0.
      • Add

        public EInteger Add​(long longValue)
        Adds this arbitrary-precision integer and a 64-bit signed integer and returns the result.
        Parameters:
        longValue - The parameter longValue is a 64-bit signed integer.
        Returns:
        The sum of the two numbers, that is, this arbitrary-precision integer plus a 64-bit signed integer.
      • Subtract

        public EInteger Subtract​(long longValue)
        Subtracts a 64-bit signed integer from this arbitrary-precision integer and returns the result.
        Parameters:
        longValue - The parameter longValue is a 64-bit signed integer.
        Returns:
        The difference between the two numbers, that is, this arbitrary-precision integer minus a 64-bit signed integer.
      • Multiply

        public EInteger Multiply​(long longValue)
        Multiplies this arbitrary-precision integer by a 64-bit signed integer and returns the result.
        Parameters:
        longValue - The parameter longValue is a 64-bit signed integer.
        Returns:
        The product of the two numbers, that is, this arbitrary-precision integer times a 64-bit signed integer.
      • Divide

        public EInteger Divide​(long longValue)
        Divides this arbitrary-precision integer by a 64-bit signed integer and returns the result. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 64-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative.
        Parameters:
        longValue - The parameter longValue is a 64-bit signed integer.
        Returns:
        The result of dividing this arbitrary-precision integer by a 64-bit signed integer. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 64-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative.
      • Remainder

        public EInteger Remainder​(long longValue)
        Returns the remainder that would result when this arbitrary-precision integer is divided by a 64-bit signed integer. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other 64-bit signed integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
        Parameters:
        longValue - The parameter longValue is a 64-bit signed integer.
        Returns:
        The remainder that would result when this arbitrary-precision integer is divided by a 64-bit signed integer.
      • compareTo

        public int compareTo​(long longValue)
        Compares an arbitrary-precision integer with this instance.
        Parameters:
        longValue - The parameter longValue is a 64-bit signed integer.
        Returns:
        Zero if the values are equal; a negative number if this instance is less, or a positive number if this instance is greater.
      • DivRem

        public EInteger[] DivRem​(long intDivisor)
        Divides this arbitrary-precision integer by a 64-bit signed integer and returns a two-item array containing the result of the division and the remainder, in that order. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 64-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other 64-bit signed integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
        Parameters:
        intDivisor - The parameter intDivisor is a 64-bit signed integer.
        Returns:
        An array of two items: the first is the result of the division as an arbitrary-precision integer, and the second is the remainder as an arbitrary-precision integer. The result of division is the result of the Divide method on the two operands, and the remainder is the result of the Remainder method on the two operands.
      • DivRem

        public EInteger[] DivRem​(EInteger divisor)
        Divides this arbitrary-precision integer by another arbitrary-precision integer and returns a two-item array containing the result of the division and the remainder, in that order. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other arbitrary-precision integer is negative, or vice versa, and will be positive if both are positive or both are negative. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other arbitrary-precision integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
        Parameters:
        divisor - The number to divide by.
        Returns:
        An array of two items: the first is the result of the division as an arbitrary-precision integer, and the second is the remainder as an arbitrary-precision integer. The result of division is the result of the Divide method on the two operands, and the remainder is the result of the Remainder method on the two operands.
        Throws:
        java.lang.ArithmeticException - The parameter divisor is 0.
        java.lang.NullPointerException - The parameter divisor is null.
      • equals

        public boolean equals​(java.lang.Object obj)
        Determines whether this object and another object are equal and have the same type.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The parameter obj is an arbitrary object.
        Returns:
        true if this object and another object are equal; otherwise, false.
      • Gcd

        public EInteger Gcd​(EInteger bigintSecond)
        Returns the greatest common divisor of this integer and the given integer. The greatest common divisor (GCD) is also known as the greatest common factor (GCF). This method works even if either or both integers are negative.
        Parameters:
        bigintSecond - Another arbitrary-precision integer. Can be negative.
        Returns:
        The greatest common divisor of this integer and the given integer.
        Throws:
        java.lang.NullPointerException - The parameter bigintSecond is null.
        java.lang.ArithmeticException - Attempted to divide by zero.
        java.lang.IllegalArgumentException - BigPower is negative.
      • GetDigitCountAsEInteger

        public EInteger GetDigitCountAsEInteger()
        Returns the number of decimal digits used by this integer, in the form of an arbitrary-precision integer.
        Returns:
        The number of digits in the decimal form of this integer. Returns 1 if this number is 0.
      • GetDigitCount

        @Deprecated
        public int GetDigitCount()
        Deprecated.
        This method may overflow. Use GetDigitCountAsEInteger instead.
        Returns the number of decimal digits used by this integer.
        Returns:
        The number of digits in the decimal form of this integer. Returns 1 if this number is 0.
        Throws:
        java.lang.ArithmeticException - The return value would exceed the range of a 32-bit signed integer.
      • GetDigitCountAsInt64

        public long GetDigitCountAsInt64()
        Returns the number of decimal digits used by this integer, in the form of a 64-bit signed integer.
        Returns:
        The number of digits in the decimal form of this integer. Returns 1 if this number is 0. Returns 2^63 - 1(Long.MAX_VALUE in.NET or Long.MAX_VALUE in Java) if the number of decimal digits is 2^63 - 1 or greater. (Use GetDigitCountAsEInteger instead if the application relies on the exact number of decimal digits.).
      • hashCode

        public int hashCode()
        Returns the hash code for this instance. No application or process IDs are used in the hash code calculation.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A 32-bit signed integer.
      • GetLowBit

        @Deprecated
        public int GetLowBit()
        Deprecated.
        This method may overflow. Use GetLowBitAsEInteger instead.
        Gets the bit position of the lowest set bit in this number's absolute value. (This will also be the position of the lowest set bit in the number's two's-complement form (see "Forms of numbers").).
        Returns:
        The bit position of the lowest bit set in the number's absolute value, starting at 0. Returns -1 if this value is 0.
      • GetLowBitAsInt64

        public long GetLowBitAsInt64()
        Gets the bit position of the lowest set bit in this number's absolute value, in the form of a 64-bit signed integer. (This will also be the position of the lowest set bit in the number's two's-complement form (see "Forms of numbers" ).).
        Returns:
        The bit position of the lowest bit set in the number's absolute value, starting at 0. Returns -1 if this value is 0 or odd. Returns 2^63 - 1 (Long.MAX_VALUE in.NET or Long.MAX_VALUE in Java) if this number is other than zero but the lowest set bit is at 2^63 - 1 or greater. (Use GetLowBitAsEInteger instead if the application relies on the exact value of the lowest set bit position.).
      • GetLowBitAsEInteger

        public EInteger GetLowBitAsEInteger()
        Gets the bit position of the lowest set bit in this number's absolute value, in the form of an arbitrary-precision integer. (This will also be the position of the lowest set bit in the number's two's-complement form (see "Forms of numbers").).
        Returns:
        The bit position of the lowest bit set in the number's absolute value, starting at 0. Returns -1 if this value is 0 or odd.
      • GetSignedBit

        public boolean GetSignedBit​(EInteger bigIndex)
        Returns whether a bit is set in the two's-complement form (see "Forms of numbers") of this object's value.
        Parameters:
        bigIndex - The index, starting at zero, of the bit to test, where 0 is the least significant bit, 1 is the next least significant bit, and so on.
        Returns:
        true if the given bit is set in the two' s-complement form (see EDecimal) of this object's value; otherwise, false.
        Throws:
        java.lang.NullPointerException - The parameter bigIndex is null.
      • GetSignedBit

        public boolean GetSignedBit​(int index)
        Returns whether a bit is set in the two's-complement form (see "Forms of numbers") of this object's value.
        Parameters:
        index - The index, starting at 0, of the bit to test, where 0 is the least significant bit, 1 is the next least significant bit, and so on.
        Returns:
        true if the given bit is set in the two' s-complement form (see EDecimal) of this object's value; otherwise, false.
      • GetSignedBitLengthAsEInteger

        public EInteger GetSignedBitLengthAsEInteger()
        Finds the minimum number of bits needed to represent this object's value, except for its sign, and returns that number of bits as an arbitrary-precision integer. If the value is negative, finds the number of bits in the value equal to this object's absolute value minus 1. For example, all integers in the interval [-(2^63), (2^63) - 1], which is the same as the range of integers in Java's and.NET's long type, have a signed bit length of 63 or less, and all other integers have a signed bit length of greater than 63.
        Returns:
        The number of bits in this object's value, except for its sign. Returns 0 if this object's value is 0 or negative 1.
      • GetSignedBitLengthAsInt64

        public long GetSignedBitLengthAsInt64()
        Finds the minimum number of bits needed to represent this object's value, except for its sign, and returns that number of bits as a 64-bit signed integer. If the value is negative, finds the number of bits in the value equal to this object's absolute value minus 1. For example, all integers in the interval [-(2^63), (2^63) - 1], which is the same as the range of integers in Java's and.NET's long type, have a signed bit length of 63 or less, and all other integers have a signed bit length of greater than 63.
        Returns:
        The number of bits in this object's value, except for its sign. Returns 0 if this object's value is 0 or negative 1. If the return value would be greater than 2^63 - 1 (Long.MAX_VALUE in.NET or Long.MAX_VALUE in Java), returns 2^63 - 1 instead. (Use GetSignedBitLengthAsEInteger instead of this method if the application relies on the exact number of bits.).
      • GetSignedBitLength

        @Deprecated
        public int GetSignedBitLength()
        Deprecated.
        This method may overflow. Use GetSignedBitLengthAsEInteger instead.
        Finds the minimum number of bits needed to represent this object's value, except for its sign. If the value is negative, finds the number of bits in the value equal to this object's absolute value minus 1. For example, all integers in the interval [-(2^63), (2^63) - 1], which is the same as the range of integers in Java's and.NET's long type, have a signed bit length of 63 or less, and all other integers have a signed bit length of greater than 63.
        Returns:
        The number of bits in this object's value, except for its sign. Returns 0 if this object's value is 0 or negative 1.
        Throws:
        java.lang.ArithmeticException - The return value would exceed the range of a 32-bit signed integer.
      • GetUnsignedBit

        public boolean GetUnsignedBit​(EInteger bigIndex)
        Returns whether a bit is set in this number's absolute value.
        Parameters:
        bigIndex - The index, starting at zero, of the bit to test, where 0 is the least significant bit, 1 is the next least significant bit, and so on.
        Returns:
        true if the given bit is set in this number's absolute value.
        Throws:
        java.lang.NullPointerException - The parameter bigIndex is null.
      • GetUnsignedBit

        public boolean GetUnsignedBit​(int index)
        Returns whether a bit is set in this number's absolute value.
        Parameters:
        index - The index, starting at 0, of the bit to test, where 0 is the least significant bit, 1 is the next least significant bit, and so on.
        Returns:
        true if the given bit is set in this number's absolute value.
      • GetUnsignedBitLengthAsEInteger

        public EInteger GetUnsignedBitLengthAsEInteger()
        Finds the minimum number of bits needed to represent this number's absolute value, and returns that number of bits as an arbitrary-precision integer. For example, all integers in the interval [-((2^63) - 1), (2^63) - 1] have an unsigned bit length of 63 or less, and all other integers have an unsigned bit length of greater than 63. This interval is not the same as the range of integers in Java's and.NET's long type.
        Returns:
        The number of bits in this object's absolute value. Returns 0 if this object's value is 0, and returns 1 if the value is negative 1.
      • GetUnsignedBitLengthAsInt64

        public long GetUnsignedBitLengthAsInt64()
        Finds the minimum number of bits needed to represent this number's absolute value, and returns that number of bits as a 64-bit signed integer. For example, all integers in the interval [-((2^63) - 1), (2^63) - 1] have an unsigned bit length of 63 or less, and all other integers have an unsigned bit length of greater than 63. This interval is not the same as the range of integers in Java's and.NET's long type.
        Returns:
        The number of bits in this object's absolute value. Returns 0 if this object's value is 0, and returns 1 if the value is negative 1. If the return value would be greater than 2^63 - 1( Long.MAX_VALUE in.NET or Long.MAX_VALUE in Java), returns 2^63 - 1 instead. (Use GetUnsignedBitLengthAsEInteger instead of this method if the application relies on the exact number of bits.).
      • GetUnsignedBitLength

        @Deprecated
        public int GetUnsignedBitLength()
        Deprecated.
        This method may overflow. Use GetUnsignedBitLengthAsEInteger instead.
        Finds the minimum number of bits needed to represent this number's absolute value. For example, all integers in the interval [-((2^63) - 1), (2^63) - 1] have an unsigned bit length of 63 or less, and all other integers have an unsigned bit length of greater than 63. This interval is not the same as the range of integers in Java's and.NET's long type.
        Returns:
        The number of bits in this object's absolute value. Returns 0 if this object's value is 0, and returns 1 if the value is negative 1.
        Throws:
        java.lang.ArithmeticException - The return value would exceed the range of a 32-bit signed integer.
      • Mod

        public EInteger Mod​(EInteger divisor)
        Finds the modulus remainder that results when this instance is divided by the value of an arbitrary-precision integer. The modulus remainder is the same as the normal remainder if the normal remainder is positive, and equals divisor plus normal remainder if the normal remainder is negative.
        Parameters:
        divisor - The number to divide by.
        Returns:
        An arbitrary-precision integer.
        Throws:
        java.lang.IllegalArgumentException - The parameter divisor is less than 0.
        java.lang.NullPointerException - The parameter divisor is null.
      • Mod

        public EInteger Mod​(int smallDivisor)
        Finds the modulus remainder that results when this instance is divided by the value of another integer. The modulus remainder is the same as the normal remainder if the normal remainder is positive, and equals divisor plus normal remainder if the normal remainder is negative.
        Parameters:
        smallDivisor - The divisor of the modulus.
        Returns:
        The modulus remainder.
        Throws:
        java.lang.IllegalArgumentException - The parameter smallDivisor is less than 0.
      • ModPow

        public EInteger ModPow​(EInteger pow,
                               EInteger mod)
        Calculates the remainder when this arbitrary-precision integer raised to a certain power is divided by another arbitrary-precision integer.
        Parameters:
        pow - The power to raise this integer by.
        mod - The integer to divide the raised number by.
        Returns:
        An arbitrary-precision integer.
        Throws:
        java.lang.NullPointerException - The parameter pow or mod is null.
      • Multiply

        public EInteger Multiply​(EInteger bigintMult)
        Multiplies this arbitrary-precision integer by another arbitrary-precision integer and returns the result.
        Parameters:
        bigintMult - Another arbitrary-precision integer.
        Returns:
        The product of the two numbers, that is, this arbitrary-precision integer times another arbitrary-precision integer.
        Throws:
        java.lang.NullPointerException - The parameter bigintMult is null.
      • Negate

        public EInteger Negate()
        Gets the value of this object with the sign reversed.
        Returns:
        This object's value with the sign reversed.
      • Pow

        public EInteger Pow​(long longPower)
        Raises an arbitrary-precision integer to a power.
        Parameters:
        longPower - The exponent to raise this integer to.
        Returns:
        The result. Returns 1 if longPower is 0.
        Throws:
        java.lang.IllegalArgumentException - BigPower is negative.
      • Pow

        public EInteger Pow​(EInteger bigPower)
        Raises an arbitrary-precision integer to a power.
        Parameters:
        bigPower - The exponent to raise this integer to.
        Returns:
        The result. Returns 1 if bigPower is 0.
        Throws:
        java.lang.NullPointerException - The parameter bigPower is null.
        java.lang.IllegalArgumentException - BigPower is negative.
      • Pow

        public EInteger Pow​(int powerSmall)
        Raises an arbitrary-precision integer to a power.
        Parameters:
        powerSmall - The exponent to raise this integer to.
        Returns:
        The result. Returns 1 if powerSmall is 0.
      • PowBigIntVar

        @Deprecated
        public EInteger PowBigIntVar​(EInteger power)
        Deprecated.
        Use Pow instead.
        Raises an arbitrary-precision integer to a power, which is given as another arbitrary-precision integer.
        Parameters:
        power - The exponent to raise to.
        Returns:
        The result. Returns 1 if power is 0.
        Throws:
        java.lang.IllegalArgumentException - The parameter power is less than 0.
        java.lang.NullPointerException - The parameter power is null.
      • Remainder

        public EInteger Remainder​(EInteger divisor)
        Returns the remainder that would result when this arbitrary-precision integer is divided by another arbitrary-precision integer. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other arbitrary-precision integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
        Parameters:
        divisor - The number to divide by.
        Returns:
        The remainder that would result when this arbitrary-precision integer is divided by another arbitrary-precision integer.
        Throws:
        java.lang.ArithmeticException - Attempted to divide by zero.
        java.lang.NullPointerException - The parameter divisor is null.
      • ShiftRight

        public EInteger ShiftRight​(EInteger eshift)
        Returns an arbitrary-precision integer with the bits shifted to the right. For this operation, the arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers"). Thus, for negative values, the arbitrary-precision integer is sign-extended.
        Parameters:
        eshift - The number of bits to shift. Can be negative, in which case this is the same as ShiftLeft with the absolute value of this parameter.
        Returns:
        An arbitrary-precision integer.
        Throws:
        java.lang.NullPointerException - The parameter eshift is null.
      • ShiftLeft

        public EInteger ShiftLeft​(EInteger eshift)
        Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits given as an arbitrary-precision integer. A value of 1 doubles this value, a value of 2 multiplies it by 4, a value of 3 by 8, a value of 4 by 16, and so on.
        Parameters:
        eshift - The number of bits to shift. Can be negative, in which case this is the same as ShiftRight with the absolute value of this parameter.
        Returns:
        An arbitrary-precision integer.
        Throws:
        java.lang.NullPointerException - The parameter eshift is null.
      • ShiftLeft

        public EInteger ShiftLeft​(int numberBits)
        Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits. A value of 1 doubles this value, a value of 2 multiplies it by 4, a value of 3 by 8, a value of 4 by 16, and so on.
        Parameters:
        numberBits - The number of bits to shift. Can be negative, in which case this is the same as shiftRight with the absolute value of this parameter.
        Returns:
        An arbitrary-precision integer.
      • Not

        public EInteger Not()
        Returns an arbitrary-precision integer with every bit flipped from this one (also called an inversion or NOT operation).
        Returns:
        An arbitrary-precision integer in which each bit in its two's complement representation is set if the corresponding bit of this integer is clear, and vice versa. Returns -1 if this integer is 0. If this integer is positive, the return value is negative, and vice versa. This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, NOT 10100 =...11101011 (or in decimal, NOT 20 = -21). In binary, NOT...11100110 = 11001 (or in decimal, NOT -26 = 25).
      • LowBits

        public EInteger LowBits​(long longBitCount)
        Extracts the lowest bits of this integer. This is equivalent to And(2^longBitCount - 1), but is more efficient when this integer is non-negative and longBitCount's value is large.
        Parameters:
        longBitCount - The number of bits to extract from the lowest part of this integer.
        Returns:
        A value equivalent to And(2^longBitCount - 1).
      • LowBits

        public EInteger LowBits​(int bitCount)
        Extracts the lowest bits of this integer. This is equivalent to And(2^bitCount - 1), but is more efficient when this integer is non-negative and bitCount's value is large.
        Parameters:
        bitCount - The number of bits to extract from the lowest part of this integer.
        Returns:
        A value equivalent to And(2^bitCount - 1).
      • LowBits

        public EInteger LowBits​(EInteger bigBitCount)
        Extracts the lowest bits of this integer. This is equivalent to And(2^bigBitCount - 1), but is more efficient when this integer is non-negative and bigBitCount's value is large.
        Parameters:
        bigBitCount - The number of bits to extract from the lowest part of this integer.
        Returns:
        A value equivalent to And(2^bigBitCount - 1).
        Throws:
        java.lang.NullPointerException - The parameter bigBitCount is null.
      • And

        public EInteger And​(EInteger other)
        Does an AND operation between this arbitrary-precision integer and another one.

        Each arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers") for the purposes of this operator.

        Parameters:
        other - Another arbitrary-precision integer that participates in the operation.
        Returns:
        An arbitrary-precision integer in which each bit is set if the corresponding bits of this integer and the other integer (in their two's-complement representation) are both set. For example, in binary, 10110 AND 01100 = 00100 (or in decimal, 22 AND 12 = 4). This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, ...11100111 AND 01100 = 00100 (or in decimal, -25 AND 12 = 4).
        Throws:
        java.lang.NullPointerException - The parameter other is null.
      • Or

        public EInteger Or​(EInteger second)
        Does an OR operation between this arbitrary-precision integer and another one.

        Each arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers") for the purposes of this operator.

        Parameters:
        second - Another arbitrary-precision integer that participates in the operation.
        Returns:
        An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set, the other integer's corresponding bit is set, or both. For example, in binary, 10110 OR 11010 = 11110 (or in decimal, 22 OR 26 = 30). This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, ...11101110 OR 01011 =...11101111 (or in decimal, -18 OR 11 = -17).
        Throws:
        java.lang.NullPointerException - The parameter second is null.
      • AndNot

        public EInteger AndNot​(EInteger second)
        Does an AND NOT operation between this arbitrary-precision integer and another one.

        Each arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers") for the purposes of this operator.

        Parameters:
        second - Another arbitrary-precision integer that participates in the operation.
        Returns:
        An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set, and the other integer's corresponding bit is not set. For example, in binary, 10110 AND NOT 11010 = 00100 (or in decimal, 22 AND NOT 26 = 4). This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, ...11101110 AND NOT 01011 = 00100 (or in decimal, -18 OR 11 = 4).
        Throws:
        java.lang.NullPointerException - The parameter second is null.
      • OrNot

        public EInteger OrNot​(EInteger second)
        Does an OR NOT operation between this arbitrary-precision integer and another one.

        Each arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers") for the purposes of this operator.

        Parameters:
        second - Another arbitrary-precision integer that participates in the operation.
        Returns:
        An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set, the other integer's corresponding bit is not set, or both. For example, in binary, 10110 OR NOT 11010 = 00100 (or in decimal, 22 OR NOT 26 = 23). This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, ...11101110 OR NOT 01011 =...11111110 (or in decimal, -18 OR 11 = -2).
        Throws:
        java.lang.NullPointerException - The parameter second is null.
      • Imp

        public EInteger Imp​(EInteger second)
        Does an OR NOT operation between this arbitrary-precision integer and another one.

        Each arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers") for the purposes of this operator.

        Parameters:
        second - Another arbitrary-precision integer that participates in the operation.
        Returns:
        An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set, the other integer's corresponding bit is not set, or both. For example, in binary, 10110 OR NOT 11010 = 00100 (or in decimal, 22 OR NOT 26 = 23). This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, ...11101110 OR NOT 01011 =...11111110 (or in decimal, -18 OR 11 = -2).
        Throws:
        java.lang.NullPointerException - The parameter second is null.
      • XorNot

        public EInteger XorNot​(EInteger second)
        Does an XOR NOT operation (or equivalence operation, EQV operation, or exclusive-OR NOT operation) between this arbitrary-precision integer and another one.

        Each arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers") for the purposes of this operator.

        Parameters:
        second - Another arbitrary-precision integer that participates in the operation.
        Returns:
        An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set or the other integer's corresponding bit is not set, but not both. For example, in binary, 10110 XOR NOT 11010 = 10011 (or in decimal, 22 XOR NOT 26 = 19). This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, ...11101110 XOR NOT 01011 =...11111010 (or in decimal, -18 OR 11 = -6).
        Throws:
        java.lang.NullPointerException - The parameter second is null.
      • Eqv

        public EInteger Eqv​(EInteger second)
        Does an XOR NOT operation (or equivalence operation, EQV operation, or exclusive-OR NOT operation) between this arbitrary-precision integer and another one.

        Each arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers") for the purposes of this operator.

        Parameters:
        second - Another arbitrary-precision integer that participates in the operation.
        Returns:
        An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set or the other integer's corresponding bit is not set, but not both. For example, in binary, 10110 XOR NOT 11010 = 10011 (or in decimal, 22 XOR NOT 26 = 19). This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, ...11101110 XOR NOT 01011 =...11111010 (or in decimal, -18 OR 11 = -6).
        Throws:
        java.lang.NullPointerException - The parameter second is null.
      • Xor

        public EInteger Xor​(EInteger other)
        Does an exclusive OR (XOR) operation between this arbitrary-precision integer and another one.
        Parameters:
        other - Another arbitrary-precision integer that participates in the operation.
        Returns:
        An arbitrary-precision integer in which each bit is set if the corresponding bit is set in one input integer but not in the other. For example, in binary, 11010 XOR 01001 = 10011 (or in decimal, 26 XOR 9 = 19). This method uses the two's complement form of negative integers (see EDecimal). For example, in binary, ...11101101 XOR 00011 =...11101110 (or in decimal, -19 XOR 3 = -18).
        Throws:
        java.lang.NullPointerException - The parameter other is null.
      • ShiftRight

        public EInteger ShiftRight​(int numberBits)
        Returns an arbitrary-precision integer with the bits shifted to the right. For this operation, the arbitrary-precision integer is treated as a two's-complement form (see "Forms of numbers"). Thus, for negative values, the arbitrary-precision integer is sign-extended.
        Parameters:
        numberBits - The number of bits to shift. Can be negative, in which case this is the same as shiftLeft with the absolute value of this parameter.
        Returns:
        An arbitrary-precision integer.
      • Sqrt

        public EInteger Sqrt()
        Finds the square root of this instance's value, rounded down.
        Returns:
        The square root of this object's value. Returns 0 if this value is 0 or less.
      • SqrtRem

        public EInteger[] SqrtRem()
        Calculates the square root and the remainder.
        Returns:
        An array of two arbitrary-precision integers: the first integer is the square root, and the second is the difference between this value and the square of the first integer. Returns two zeros if this value is 0 or less, or one and zero if this value equals 1.
      • Root

        public EInteger Root​(EInteger root)
        Finds the nth root of this instance's value, rounded down.
        Parameters:
        root - The root to find; must be 1 or greater. If this value is 2, this method finds the square root; if 3, the cube root, and so on.
        Returns:
        The square root of this object's value. Returns 0 if this value is 0 or less.
        Throws:
        java.lang.NullPointerException - The parameter root is null.
      • RootRem

        public EInteger[] RootRem​(EInteger root)
        Calculates the nth root and the remainder.
        Parameters:
        root - The root to find; must be 1 or greater. If this value is 2, this method finds the square root; if 3, the cube root, and so on.
        Returns:
        An array of two arbitrary-precision integers: the first integer is the nth root, and the second is the difference between this value and the nth power of the first integer. Returns two zeros if this value is 0 or less, or one and zero if this value equals 1.
        Throws:
        java.lang.NullPointerException - The parameter root is null.
      • Root

        public EInteger Root​(int root)
        Finds the nth root of this instance's value, rounded down.
        Parameters:
        root - The root to find; must be 1 or greater. If this value is 2, this method finds the square root; if 3, the cube root, and so on.
        Returns:
        The square root of this object's value. Returns 0 if this value is 0 or less.
      • RootRem

        public EInteger[] RootRem​(int root)
        Calculates the nth root and the remainder.
        Parameters:
        root - The root to find; must be 1 or greater. If this value is 2, this method finds the square root; if 3, the cube root, and so on.
        Returns:
        An array of two arbitrary-precision integers: the first integer is the nth root, and the second is the difference between this value and the nth power of the first integer. Returns two zeros if this value is 0 or less, or one and zero if this value equals 1.
      • Subtract

        public EInteger Subtract​(EInteger subtrahend)
        Subtracts an arbitrary-precision integer from this arbitrary-precision integer and returns the result.
        Parameters:
        subtrahend - Another arbitrary-precision integer.
        Returns:
        The difference between the two numbers, that is, this arbitrary-precision integer minus another arbitrary-precision integer.
        Throws:
        java.lang.NullPointerException - The parameter subtrahend is null.
      • ToBytes

        public byte[] ToBytes​(boolean littleEndian)
        Returns a byte array of this integer's value. The byte array will take the number's two's-complement form (see "Forms of numbers"), using the fewest bytes necessary to store its value unambiguously. If this value is negative, the bits that appear beyond the most significant bit of the number will be all ones. The resulting byte array can be passed to the FromBytes() method (with the same byte order) to reconstruct this integer's value.
        Parameters:
        littleEndian - See the 'littleEndian' parameter of the FromBytes() method.
        Returns:
        A byte array. If this value is 0, returns a byte array with the single element 0.
      • ToInt32Checked

        public int ToInt32Checked()
        Converts this object's value to a 32-bit signed integer, throwing an exception if it can't fit.
        Returns:
        A 32-bit signed integer.
      • ToInt32Unchecked

        public int ToInt32Unchecked()
        Converts this object's value to a 32-bit signed integer. If the value can't fit in a 32-bit integer, returns the lower 32 bits of this object's two's-complement form (see "Forms of numbers") (in which case the return value might have a different sign than this object's value).
        Returns:
        A 32-bit signed integer.
      • ToInt64Checked

        public long ToInt64Checked()
        Converts this object's value to a 64-bit signed integer, throwing an exception if it can't fit.
        Returns:
        A 64-bit signed integer.
      • ToInt64Unchecked

        public long ToInt64Unchecked()
        Converts this object's value to a 64-bit signed integer. If the value can't fit in a 64-bit integer, returns the lower 64 bits of this object's two's-complement form (see "Forms of numbers") (in which case the return value might have a different sign than this object's value).
        Returns:
        A 64-bit signed integer.
      • ToRadixString

        public java.lang.String ToRadixString​(int radix)
        Generates a string representing the value of this object, in the given radix.
        Parameters:
        radix - A radix from 2 through 36. For example, to generate a hexadecimal (base-16) string, specify 16. To generate a decimal (base-10) string, specify 10.
        Returns:
        A string representing the value of this object. If this value is 0, returns "0". If negative, the string will begin with a minus sign ("-", U+002D). Depending on the radix, the string will use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic upper-case letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16.
      • toString

        public java.lang.String toString()
        Converts this object to a text string in base 10.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of this object. If this value is 0, returns "0". If negative, the string will begin with a minus sign ("-", U+002D). The string will use the basic digits 0 to 9 (U+0030 to U+0039).
      • Increment

        public EInteger Increment()
        Returns one added to this arbitrary-precision integer.
        Returns:
        The given arbitrary-precision integer plus one.
      • Decrement

        public EInteger Decrement()
        Returns one subtracted from this arbitrary-precision integer.
        Returns:
        The given arbitrary-precision integer minus one.
      • ToByteChecked

        public byte ToByteChecked()
        Converts this number's value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255).
        Returns:
        This number's value as a byte (from 0 to 255).
        Throws:
        java.lang.ArithmeticException - This value is less than 0 or greater than 255.
      • ToByteUnchecked

        public byte ToByteUnchecked()
        Converts this number to a byte (from 0 to 255), returning the least-significant bits of this number's two's-complement form.
        Returns:
        This number, converted to a byte (from 0 to 255).
      • FromByte

        public static EInteger FromByte​(byte inputByte)
        Converts a byte (from 0 to 255) to an arbitrary-precision integer.
        Parameters:
        inputByte - The number to convert as a byte (from 0 to 255).
        Returns:
        This number's value as an arbitrary-precision integer.
      • ToInt16Checked

        public short ToInt16Checked()
        Converts this number's value to a 16-bit signed integer if it can fit in a 16-bit signed integer.
        Returns:
        This number's value as a 16-bit signed integer.
        Throws:
        java.lang.ArithmeticException - This value is less than -32768 or greater than 32767.
      • ToInt16Unchecked

        public short ToInt16Unchecked()
        Converts this number to a 16-bit signed integer, returning the least-significant bits of this number's two's-complement form.
        Returns:
        This number, converted to a 16-bit signed integer.
      • FromInt16

        public static EInteger FromInt16​(short inputInt16)
        Converts a 16-bit signed integer to an arbitrary-precision integer.
        Parameters:
        inputInt16 - The number to convert as a 16-bit signed integer.
        Returns:
        This number's value as an arbitrary-precision integer.