API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.math. BigInteger View Source
Author(s)
Josh Bloch
Michael McCloskey
Since
JDK1.1
Version
1.75, 06/28/06
Serial
Hierarchy
 Object
      Number
          BigInteger
Implements
 Comparable
Subclasses
Description
public class BigInteger
  Immutable arbitrary-precision integers.
See also:    BigDecimal
Constructors
public BigInteger (byte[] val)
  Translates a byte array containing the two's-complement binary representation of a BigInteger into a BigInteger.
private BigInteger (byte[] magnitude, int signum)
This private constructor is for internal use and assumes that its arguments are correct.
pack-private BigInteger (char[] val)
private BigInteger (int[] val)
  This private constructor translates an int array containing the two's-complement binary representation of a BigInteger into a BigInteger.
private BigInteger (int[] magnitude, int signum)
This private constructor differs from its public cousin with the arguments reversed in two ways: it assumes that its arguments are correct, and it doesn't copy the magnitude array.
public BigInteger (int signum, byte[] magnitude)
  Translates the sign-magnitude representation of a BigInteger into a BigInteger.
private BigInteger (int signum, int[] magnitude)
  A constructor for internal use that translates the sign-magnitude representation of a BigInteger into a BigInteger.
public BigInteger (int bitLength, int certainty, Random rnd)
  Constructs a randomly generated positive BigInteger that is probably prime, with the specified bitLength.
public BigInteger (int numBits, Random rnd)
  Constructs a randomly generated BigInteger, uniformly distributed over the range 0 to (2numBits - 1), inclusive.
private BigInteger (long val)
Constructs a BigInteger with the specified value, which may not be zero.
pack-private BigInteger (MutableBigInteger val, int sign)
This private constructor is for internal use in converting from a MutableBigInteger object into a BigInteger.
public BigInteger (String val)
  Translates the decimal String representation of a BigInteger into a BigInteger.
public BigInteger (String val, int radix)
  Translates the String representation of a BigInteger in the specified radix into a BigInteger.
Methods
Hide/Show inherited methods
public BigInteger abs ()
  Returns a BigInteger whose value is the absolute value of this BigInteger.
public BigInteger add (BigInteger val)
  Returns a BigInteger whose value is (this + val).
pack-privatestatic int addOne (int[] a, int offset, int mlen, int carry)
  Add one word to the number a mlen words into a.
public BigInteger and (BigInteger val)
  Returns a BigInteger whose value is (this & val).
public BigInteger andNot (BigInteger val)
  Returns a BigInteger whose value is (this & ~val).
pack-privatestatic int bitCnt (int val)
public int bitCount ()
  Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit.
pack-privatestatic int bitLen (int w)
bitLen(val) is the number of bits in val.
public int bitLength ()
  Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.
public byte byteValue () [Inherited From Number]
  Returns the value of the specified number as a byte.
public BigInteger clearBit (int n)
  Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit cleared.
public int compareTo (BigInteger val)
  Compares this BigInteger with the specified BigInteger.
public BigInteger divide (BigInteger val)
  Returns a BigInteger whose value is (this / val).
public BigInteger divideAndRemainder (BigInteger val)
  Returns an array of two BigIntegers containing (this / val) followed by (this % val).
public double doubleValue () [Specified in Number]
  Converts this BigInteger to a double.
public boolean equals (Object x)
  Compares this BigInteger with the specified Object for equality.
public BigInteger flipBit (int n)
  Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit flipped.
public float floatValue () [Specified in Number]
  Converts this BigInteger to a float.
public BigInteger gcd (BigInteger val)
  Returns a BigInteger whose value is the greatest common divisor of abs(this) and abs(val).
public int getLowestSetBit ()
  Returns the index of the rightmost (lowest-order) one bit in this BigInteger (the number of zero bits to the right of the rightmost one bit).
public int hashCode ()
  Returns the hash code for this BigInteger.
public int intValue () [Specified in Number]
  Converts this BigInteger to an int.
public boolean isProbablePrime (int certainty)
  Returns true if this BigInteger is probably prime, false if it's definitely composite.
pack-private int javaIncrement (int[] val)
public long longValue () [Specified in Number]
  Converts this BigInteger to a long.
public BigInteger max (BigInteger val)
  Returns the maximum of this BigInteger and val.
public BigInteger min (BigInteger val)
  Returns the minimum of this BigInteger and val.
public BigInteger mod (BigInteger m)
  Returns a BigInteger whose value is (this mod m).
public BigInteger modInverse (BigInteger m)
  Returns a BigInteger whose value is (this-1 mod m).
public BigInteger modPow (BigInteger exponent, BigInteger m)
  Returns a BigInteger whose value is (thisexponent mod m).
pack-privatestatic int mulAdd (int[] out, int[] in, int offset, int len, int k)
Multiply an array by one word k and add to result, return the carry
public BigInteger multiply (BigInteger val)
  Returns a BigInteger whose value is (this * val).
public BigInteger negate ()
  Returns a BigInteger whose value is (-this).
public BigInteger nextProbablePrime ()
  Returns the first integer greater than this BigInteger that is probably prime.
public BigInteger not ()
  Returns a BigInteger whose value is (~this).
public BigInteger or (BigInteger val)
  Returns a BigInteger whose value is (this | val).
public BigInteger pow (int exponent)
  Returns a BigInteger whose value is (thisexponent).
pack-private boolean primeToCertainty (int certainty, Random random)
  Returns true if this BigInteger is probably prime, false if it's definitely composite.
pack-privatestatic void primitiveLeftShift (int[] a, int len, int n)
pack-privatestatic void primitiveRightShift (int[] a, int len, int n)
publicstatic BigInteger probablePrime (int bitLength, Random rnd)
  Returns a positive BigInteger that is probably prime, with the specified bitLength.
public BigInteger remainder (BigInteger val)
  Returns a BigInteger whose value is (this % val).
public BigInteger setBit (int n)
  Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit set.
public BigInteger shiftLeft (int n)
  Returns a BigInteger whose value is (this << n).
public BigInteger shiftRight (int n)
  Returns a BigInteger whose value is (this >> n).
public short shortValue () [Inherited From Number]
  Returns the value of the specified number as a short.
public int signum ()
  Returns the signum function of this BigInteger.
public BigInteger subtract (BigInteger val)
  Returns a BigInteger whose value is (this - val).
public boolean testBit (int n)
  Returns true if and only if the designated bit is set.
public byte toByteArray ()
  Returns a byte array containing the two's-complement representation of this BigInteger.
public String toString ()
  Returns the decimal String representation of this BigInteger.
public String toString (int radix)
  Returns the String representation of this BigInteger in the given radix.
pack-privatestatic int trailingZeroCnt (int val)
publicstatic BigInteger valueOf (long val)
  Returns a BigInteger whose value is equal to that of the specified long.
public BigInteger xor (BigInteger val)
  Returns a BigInteger whose value is (this ^ val).
Fields
Hide/Show inherited fields
pack-privatestatic int bnExpModThreshTable
pack-private int mag
  The magnitude of this BigInteger, in big-endian order: the zeroth element of this array is the most-significant int of the magnitude.
publicfinalstatic BigInteger ONE
  The BigInteger constant one.
pack-private int signum
  The signum of this BigInteger: -1 for negative, 0 for zero, or 1 for positive.
publicfinalstatic BigInteger TEN
  The BigInteger constant ten.
pack-privatefinalstatic byte trailingZeroTable
publicfinalstatic BigInteger ZERO
  The BigInteger constant zero.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar