Name
BigInteger
Synopsis
This subclass of
java.lang.Number
represents integers that can be
arbitrarily large (i.e., integers that are not limited to the 64 bits
available with the long
data type).
BigInteger
defines methods that duplicate the
functionality of the standard Java arithmetic and bit-manipulation
operators. The compareTo(
)
method
compares two BigInteger
objects and returns -1, 0,
or 1 to indicate the result of the comparison. The gcd(
)
, modPow( )
,
modInverse( )
, and isProbablePrime(
)
methods perform advanced operations and are used
primarily in
cryptographic and
related algorithms.
Figure 11-2. java.math.BigInteger
public class BigInteger extends Number implements Comparable<BigInteger> { // Public Constructors public BigInteger(byte[ ] val); public BigInteger(String val); public BigInteger(String val, int radix); public BigInteger(int signum, byte[ ] magnitude); public BigInteger(int numBits, java.util.Random rnd); public BigInteger(int bitLength, int certainty, java.util.Random rnd); // Public Constants 1.2 public static final BigInteger ONE; 5.0 public static final BigInteger TEN; 1.2 public static final BigInteger ZERO; // Public Class Methods 1.4 public static BigInteger probablePrime(int bitLength, java.util.Random rnd); public static BigInteger valueOf(long val); // Public Instance Methods public BigInteger abs( ); public BigInteger add(BigInteger val); public ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.