<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.math.BigInteger
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.math.html">This Package</a>  <a href="java.math.BigDecimal.html#_top_">Previous</a>  <a href="Package-java.math.html">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.math.BigInteger
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.lang.Number.html#_top_">java.lang.Number</a>
           |
           +----java.math.BigInteger
</pre>
<hr>
<dl>
  <dt> public class <b>BigInteger</b>
  <dt> extends <a href="java.lang.Number.html#_top_">Number</a>
</dl>
Immutable arbitrary-precision integers.  All operations behave as if
 BigIntegers were represented in two's-complement notation (like Java's
 primitive integer types).  BigIntegers provide analogues to all of Java's
 primitive integer operators, and all relevant static methods from
 java.lang.Math.  Additionally, BigIntegers provide operations for modular
 arithmetic, GCD calculation, primality testing, prime generation,
 single-bit manipulation, and a few other odds and ends.
 <P>Semantics of arithmetic operations exactly mimic those of java's integer
 arithmetic operators, as defined in The Java Language Specification.  For
 example, division by zero throws an ArithmeticException, and division of
 a negative by a positive yields a negative (or zero) remainder.  All of
 the details in the Spec concerning overflow are ignored, as BigIntegers
 are made as large as necessary to accommodate the results of an operation.
 <P>Semantics of shift operations extend those of Java's shift operators
 to allow for negative shift distances.  A right-shift with a negative
 shift distance results in a left shift, and vice-versa.  The unsigned
 right shift operator (>>>) is omitted, as this operation makes little
 sense in combination with the "infinite word size" abstraction provided
 by this class.
 <P>Semantics of bitwise logical operations are are exactly mimic those of
 Java's bitwise integer operators.  The Binary operators (and, or, xor)
 implicitly perform sign extension on the shorter of the two operands
 prior to performing the operation.
 <P>Comparison operations perform signed integer comparisons, analogous to
 those performed by java's relational and equality operators.
 <P>Modular arithmetic operations are provided to compute residues, perform
 exponentiation, and compute multiplicative inverses.  These methods always
 return a non-negative result, between 0 and (modulus - 1), inclusive.
 <P>Single-bit operations operate on a single bit of the two's-complement
 representation of their operand.  If necessary, the operand is sign
 extended so that it contains the designated bit.  None of the single-bit
 operations can produce a number with a different sign from the the
 BigInteger being operated on, as they affect only a single bit, and the
 "infinite word size" abstraction provided by this class ensures that there
 are infinitely many "virtual sign bits" preceding each BigInteger.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.math.BigDecimal.html#_top_">BigDecimal</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigInteger(byte[])"><b>BigInteger</b></a>(byte[])
  <dd>  Translates a byte array containing the two's-complement representation
 of a (signed) integer into a BigInteger.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigInteger(int, byte[])"><b>BigInteger</b></a>(int, byte[])
  <dd>  Translates the sign-magnitude representation of an integer into a
 BigInteger.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigInteger(int, int, java.util.Random)"><b>BigInteger</b></a>(int, int, Random)
  <dd>  Returns a randomly selected BigInteger with the specified bitLength
 that is probably prime.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigInteger(int, java.util.Random)"><b>BigInteger</b></a>(int, Random)
  <dd>  Returns a random number uniformly distributed on [0, 2**numBits - 1]
 (assuming a fair source of random bits is provided in rndSrc).
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigInteger(java.lang.String)"><b>BigInteger</b></a>(String)
  <dd>  Translates a string containing an optional minus sign followed by a
 sequence of one or more decimal digits into a BigInteger.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BigInteger(java.lang.String, int)"><b>BigInteger</b></a>(String, int)
  <dd>  Translates a string containing an optional minus sign followed by a
 sequence of one or more digits in the specified radix into a BigInteger.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#abs()"><b>abs</b></a>()
  <dd>  Returns a BigInteger whose value is the absolute value of this
 number.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#add(java.math.BigInteger)"><b>add</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this + val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#and(java.math.BigInteger)"><b>and</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this & val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#andNot(java.math.BigInteger)"><b>andNot</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this & ~val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#bitCount()"><b>bitCount</b></a>()
  <dd>  Returns the number of bits in the two's complement representation
 of this number that differ from its sign bit.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#bitLength()"><b>bitLength</b></a>()
  <dd>  Returns the number of bits in the minimal two's-complement
 representation of this number, *excluding* a sign bit, i.e.,
 (ceil(log2(this < 0 ? -this : this + 1))).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#clearBit(int)"><b>clearBit</b></a>(int)
  <dd>  Returns a BigInteger whose value is equivalent to this number
 with the designated bit cleared.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#compareTo(java.math.BigInteger)"><b>compareTo</b></a>(BigInteger)
  <dd>  Returns -1, 0 or 1 as this number is less than, equal to, or
 greater than val.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#divide(java.math.BigInteger)"><b>divide</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this / val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#divideAndRemainder(java.math.BigInteger)"><b>divideAndRemainder</b></a>(BigInteger)
  <dd>  Returns an array of two BigIntegers.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#doubleValue()"><b>doubleValue</b></a>()
  <dd>  Converts the number to a double.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#equals(java.lang.Object)"><b>equals</b></a>(Object)
  <dd>  Returns true iff x is a BigInteger whose value is equal to this number.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#flipBit(int)"><b>flipBit</b></a>(int)
  <dd>  Returns a BigInteger whose value is equivalent to this number
 with the designated bit flipped.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#floatValue()"><b>floatValue</b></a>()
  <dd>  Converts this number to a float.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#gcd(java.math.BigInteger)"><b>gcd</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is the greatest common denominator
 of abs(this) and abs(val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getLowestSetBit()"><b>getLowestSetBit</b></a>()
  <dd>  Returns the index of the rightmost (lowest-order) one bit in this
 number (i.e., the number of zero bits to the right of the rightmost
 one bit).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#hashCode()"><b>hashCode</b></a>()
  <dd>  Computes a hash code for this object.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#intValue()"><b>intValue</b></a>()
  <dd>  Converts this number to an int.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isProbablePrime(int)"><b>isProbablePrime</b></a>(int)
  <dd>  Returns true if this BigInteger is probably prime, false if it's
 definitely composite.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#longValue()"><b>longValue</b></a>()
  <dd>  Converts this number to a long.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#max(java.math.BigInteger)"><b>max</b></a>(BigInteger)
  <dd>  Returns the BigInteger whose value is the greater of this and val.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#min(java.math.BigInteger)"><b>min</b></a>(BigInteger)
  <dd>  Returns the BigInteger whose value is the lesser of this and val.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#mod(java.math.BigInteger)"><b>mod</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is this mod m.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#modInverse(java.math.BigInteger)"><b>modInverse</b></a>(BigInteger)
  <dd>  Returns modular multiplicative inverse of this, mod m.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#modPow(java.math.BigInteger, java.math.BigInteger)"><b>modPow</b></a>(BigInteger, BigInteger)
  <dd>  Returns a BigInteger whose value is (this ** exponent) mod m.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#multiply(java.math.BigInteger)"><b>multiply</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this * val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#negate()"><b>negate</b></a>()
  <dd>  Returns a BigInteger whose value is (-1 * this).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#not()"><b>not</b></a>()
  <dd>  Returns a BigInteger whose value is (~this).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#or(java.math.BigInteger)"><b>or</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this | val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#pow(int)"><b>pow</b></a>(int)
  <dd>  Returns a BigInteger whose value is (this ** exponent).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#remainder(java.math.BigInteger)"><b>remainder</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this % val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setBit(int)"><b>setBit</b></a>(int)
  <dd>  Returns a BigInteger whose value is equivalent to this number
 with the designated bit set.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#shiftLeft(int)"><b>shiftLeft</b></a>(int)
  <dd>  Returns a BigInteger whose value is (this << n).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#shiftRight(int)"><b>shiftRight</b></a>(int)
  <dd>  Returns a BigInteger whose value is (this >> n).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#signum()"><b>signum</b></a>()
  <dd>  Returns the signum function of this number (i.e., -1, 0 or 1 as
 the value of this number is negative, zero or positive).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#subtract(java.math.BigInteger)"><b>subtract</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this - val).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#testBit(int)"><b>testBit</b></a>(int)
  <dd>  Returns true iff the designated bit is set.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toByteArray()"><b>toByteArray</b></a>()
  <dd>  Returns the two's-complement representation of this number.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString()"><b>toString</b></a>()
  <dd>  Returns the string representation of this number, radix 10.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString(int)"><b>toString</b></a>(int)
  <dd>  Returns the string representation of this number in the given radix.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#valueOf(long)"><b>valueOf</b></a>(long)
  <dd>  Returns a BigInteger with the specified value.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#xor(java.math.BigInteger)"><b>xor</b></a>(BigInteger)
  <dd>  Returns a BigInteger whose value is (this ^ val).
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="BigInteger"></a>
<a name="BigInteger(byte[])"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigInteger</b>
<pre>
 public BigInteger(byte val[]) throws <a href="java.lang.NumberFormatException.html#_top_">NumberFormatException</a>
</pre>
<dl>
  <dd> Translates a byte array containing the two's-complement representation
 of a (signed) integer into a BigInteger.  The input array is assumed to
 be big-endian (i.e., the most significant byte is in the [0] position).
 (The most significant bit of the most significant byte is the sign bit.)
 The array must contain at least one byte or a NumberFormatException
 will be thrown.
<p>
</dl>
<a name="BigInteger(int, byte[])"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigInteger</b>
<pre>
 public BigInteger(int signum,
                   byte magnitude[]) throws <a href="java.lang.NumberFormatException.html#_top_">NumberFormatException</a>
</pre>
<dl>
  <dd> Translates the sign-magnitude representation of an integer into a
 BigInteger.  The sign is represented as an integer signum value (-1 for
 negative, 0 for zero, 1 for positive).  The magnitude is represented
 as a big-endian byte array (i.e., the most significant byte is in the
 [0] position).  An invalid signum value or a 0 signum value coupled
 with a nonzero magnitude will result in a NumberFormatException.
 A zero length magnitude array is permissible, and will result in
 in a value of 0 (irrespective of the given signum value).
<p>
</dl>
<a name="BigInteger(java.lang.String, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigInteger</b>
<pre>
 public BigInteger(<a href="java.lang.String.html#_top_">String</a> val,
                   int radix) throws <a href="java.lang.NumberFormatException.html#_top_">NumberFormatException</a>
</pre>
<dl>
  <dd> Translates a string containing an optional minus sign followed by a
 sequence of one or more digits in the specified radix into a BigInteger.
 The character-to-digit mapping is provided by Character.digit.
 Any extraneous characters (including whitespace), or a radix outside
 the range from Character.MIN_RADIX(2) to Character.MAX_RADIX(36),
 inclusive, will result in a NumberFormatException.
<p>
</dl>
<a name="BigInteger(java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigInteger</b>
<pre>
 public BigInteger(<a href="java.lang.String.html#_top_">String</a> val) throws <a href="java.lang.NumberFormatException.html#_top_">NumberFormatException</a>
</pre>
<dl>
  <dd> Translates a string containing an optional minus sign followed by a
 sequence of one or more decimal digits into a BigInteger.  The
 character-to-digit mapping is provided by Character.digit.
 Any extraneous characters (including whitespace) will result in a
 NumberFormatException.
<p>
</dl>
<a name="BigInteger(int, java.util.Random)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigInteger</b>
<pre>
 public BigInteger(int numBits,
                   <a href="java.util.Random.html#_top_">Random</a> rndSrc) throws <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
</pre>
<dl>
  <dd> Returns a random number uniformly distributed on [0, 2**numBits - 1]
 (assuming a fair source of random bits is provided in rndSrc).
 Note that this constructor always returns a non-negative BigInteger.
 Throws an IllegalArgumentException if numBits < 0.
<p>
</dl>
<a name="BigInteger(int, int, java.util.Random)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BigInteger</b>
<pre>
 public BigInteger(int bitLength,
                   int certainty,
                   <a href="java.util.Random.html#_top_">Random</a> rnd)
</pre>
<dl>
  <dd> Returns a randomly selected BigInteger with the specified bitLength
 that is probably prime.  The certainty parameter is a measure of
 the uncertainty that the caller is willing to tolerate: the probability
 that the number is prime will exceed 1 - 1/2**certainty.  The execution
 time is proportional to the value of the certainty parameter.  The
 given random number generator is used to select candidates to be
 tested for primality.  Throws an ArithmeticException if bitLength < 2.
<p>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="valueOf(long)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="valueOf"><b>valueOf</b></a>
<pre>
 public static <a href="#_top_">BigInteger</a> valueOf(long val)
</pre>
<dl>
  <dd> Returns a BigInteger with the specified value.  This factory is provided
 in preference to a (long) constructor because it allows for reuse
 of frequently used BigIntegers (like 0 and 1), obviating the need for
 exported constants.
<p>
</dl>
<a name="add(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="add"><b>add</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> add(<a href="#_top_">BigInteger</a> val) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this + val).
<p>
</dl>
<a name="subtract(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="subtract"><b>subtract</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> subtract(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this - val).
<p>
</dl>
<a name="multiply(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="multiply"><b>multiply</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> multiply(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this * val).
<p>
</dl>
<a name="divide(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="divide"><b>divide</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> divide(<a href="#_top_">BigInteger</a> val) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this / val).  Throws an
 ArithmeticException if val == 0.
<p>
</dl>
<a name="remainder(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="remainder"><b>remainder</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> remainder(<a href="#_top_">BigInteger</a> val) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this % val).  Throws an
 ArithmeticException if val == 0.
<p>
</dl>
<a name="divideAndRemainder(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="divideAndRemainder"><b>divideAndRemainder</b></a>
<pre>
 public <a href="#_top_">BigInteger</a>[] divideAndRemainder(<a href="#_top_">BigInteger</a> val) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns an array of two BigIntegers. The first ([0]) element of
 the return value is the quotient (this / val), and the second ([1])
 element is the remainder (this % val).  Throws an ArithmeticException
 if val == 0.
<p>
</dl>
<a name="pow(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="pow"><b>pow</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> pow(int exponent) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this ** exponent).  Throws
 an ArithmeticException if exponent < 0 (as the operation would yield
 a non-integer value). Note that exponent is an integer rather than
 a BigInteger.
<p>
</dl>
<a name="gcd(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="gcd"><b>gcd</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> gcd(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is the greatest common denominator
 of abs(this) and abs(val).  Returns 0 if this == 0 && val == 0.
<p>
</dl>
<a name="abs()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="abs"><b>abs</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> abs()
</pre>
<dl>
  <dd> Returns a BigInteger whose value is the absolute value of this
 number.
<p>
</dl>
<a name="negate()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="negate"><b>negate</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> negate()
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (-1 * this).
<p>
</dl>
<a name="signum()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="signum"><b>signum</b></a>
<pre>
 public int signum()
</pre>
<dl>
  <dd> Returns the signum function of this number (i.e., -1, 0 or 1 as
 the value of this number is negative, zero or positive).
<p>
</dl>
<a name="mod(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="mod"><b>mod</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> mod(<a href="#_top_">BigInteger</a> m)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is this mod m. Throws an
 ArithmeticException if m <= 0.
<p>
</dl>
<a name="modPow(java.math.BigInteger, java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="modPow"><b>modPow</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> modPow(<a href="#_top_">BigInteger</a> exponent,
                          <a href="#_top_">BigInteger</a> m)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this ** exponent) mod m.  (If
 exponent == 1, the returned value is (this mod m).  If exponent < 0,
 the returned value is the modular multiplicative inverse of
 (this ** -exponent).)  Throws an ArithmeticException if m <= 0.
<p>
</dl>
<a name="modInverse(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="modInverse"><b>modInverse</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> modInverse(<a href="#_top_">BigInteger</a> m) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns modular multiplicative inverse of this, mod m.  Throws an
 ArithmeticException if m <= 0 or this has no multiplicative inverse
 mod m (i.e., gcd(this, m) != 1).
<p>
</dl>
<a name="shiftLeft(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="shiftLeft"><b>shiftLeft</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> shiftLeft(int n)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this << n).  (Computes
 floor(this * 2**n).)
<p>
</dl>
<a name="shiftRight(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="shiftRight"><b>shiftRight</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> shiftRight(int n)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this >> n).  Sign extension is
 performed.  (Computes floor(this / 2**n).)
<p>
</dl>
<a name="and(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="and"><b>and</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> and(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this & val).  (This method
 returns a negative number iff this and val are both negative.)
<p>
</dl>
<a name="or(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="or"><b>or</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> or(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this | val).  (This method
 returns a negative number iff either this or val is negative.)
<p>
</dl>
<a name="xor(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="xor"><b>xor</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> xor(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this ^ val).  (This method
 returns a negative number iff exactly one of this and val are
 negative.)
<p>
</dl>
<a name="not()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="not"><b>not</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> not()
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (~this).  (This method returns
 a negative value iff this number is non-negative.)
<p>
</dl>
<a name="andNot(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="andNot"><b>andNot</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> andNot(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns a BigInteger whose value is (this & ~val).  This method,
 which is equivalent to and(val.not()), is provided as a convenience
 for masking operations.  (This method returns a negative number iff
 this is negative and val is positive.)
<p>
</dl>
<a name="testBit(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="testBit"><b>testBit</b></a>
<pre>
 public boolean testBit(int n) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns true iff the designated bit is set. (Computes
 ((this & (1<<n)) != 0).)  Throws an ArithmeticException if n < 0.
<p>
</dl>
<a name="setBit(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setBit"><b>setBit</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> setBit(int n) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns a BigInteger whose value is equivalent to this number
 with the designated bit set.  (Computes (this | (1<<n)).)
 Throws an ArithmeticException if n < 0.
<p>
</dl>
<a name="clearBit(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="clearBit"><b>clearBit</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> clearBit(int n) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns a BigInteger whose value is equivalent to this number
 with the designated bit cleared. (Computes (this & ~(1<<n)).)
 Throws an ArithmeticException if n < 0.
<p>
</dl>
<a name="flipBit(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="flipBit"><b>flipBit</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> flipBit(int n) throws <a href="java.lang.ArithmeticException.html#_top_">ArithmeticException</a>
</pre>
<dl>
  <dd> Returns a BigInteger whose value is equivalent to this number
 with the designated bit flipped.  (Computes (this ^ (1<<n)).)
 Throws an ArithmeticException if n < 0.
<p>
</dl>
<a name="getLowestSetBit()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getLowestSetBit"><b>getLowestSetBit</b></a>
<pre>
 public int getLowestSetBit()
</pre>
<dl>
  <dd> Returns the index of the rightmost (lowest-order) one bit in this
 number (i.e., the number of zero bits to the right of the rightmost
 one bit).  Returns -1 if this number contains no one bits.
 (Computes (this==0? -1 : log2(this & -this)).)
<p>
</dl>
<a name="bitLength()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="bitLength"><b>bitLength</b></a>
<pre>
 public int bitLength()
</pre>
<dl>
  <dd> Returns the number of bits in the minimal two's-complement
 representation of this number, *excluding* a sign bit, i.e.,
 (ceil(log2(this < 0 ? -this : this + 1))).  (For positive
 numbers, this is equivalent to the number of bits in the
 ordinary binary representation.)
<p>
</dl>
<a name="bitCount()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="bitCount"><b>bitCount</b></a>
<pre>
 public int bitCount()
</pre>
<dl>
  <dd> Returns the number of bits in the two's complement representation
 of this number that differ from its sign bit.  This method is
 useful when implementing bit-vector style sets atop BigIntegers.
<p>
</dl>
<a name="isProbablePrime(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="isProbablePrime"><b>isProbablePrime</b></a>
<pre>
 public boolean isProbablePrime(int certainty)
</pre>
<dl>
  <dd> Returns true if this BigInteger is probably prime, false if it's
 definitely composite.  The certainty parameter is a measure
 of the uncertainty that the caller is willing to tolerate:
 the method returns true if the probability that this number is
 is prime exceeds 1 - 1/2**certainty.  The execution time is
 proportional to the value of the certainty parameter.
<p>
</dl>
<a name="compareTo(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="compareTo"><b>compareTo</b></a>
<pre>
 public int compareTo(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns -1, 0 or 1 as this number is less than, equal to, or
 greater than val.  This method is provided in preference to
 individual methods for each of the six boolean comparison operators
 (<, ==, >, >=, !=, <=).  The suggested idiom for performing these
 comparisons is:  (x.compareTo(y) <op> 0), where <op> is one of the
 six comparison operators.
<p>
</dl>
<a name="equals(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="equals"><b>equals</b></a>
<pre>
 public boolean equals(<a href="java.lang.Object.html#_top_">Object</a> x)
</pre>
<dl>
  <dd> Returns true iff x is a BigInteger whose value is equal to this number.
 This method is provided so that BigIntegers can be used as hash keys.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#equals(java.lang.Object)">equals</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="min(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="min"><b>min</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> min(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns the BigInteger whose value is the lesser of this and val.
 If the values are equal, either may be returned.
<p>
</dl>
<a name="max(java.math.BigInteger)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="max"><b>max</b></a>
<pre>
 public <a href="#_top_">BigInteger</a> max(<a href="#_top_">BigInteger</a> val)
</pre>
<dl>
  <dd> Returns the BigInteger whose value is the greater of this and val.
 If the values are equal, either may be returned.
<p>
</dl>
<a name="hashCode()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="hashCode"><b>hashCode</b></a>
<pre>
 public int hashCode()
</pre>
<dl>
  <dd> Computes a hash code for this object.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#hashCode()">hashCode</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="toString(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toString(int radix)
</pre>
<dl>
  <dd> Returns the string representation of this number in the given radix.
 If the radix is outside the range from Character.MIN_RADIX(2) to
 Character.MAX_RADIX(36) inclusive, it will default to 10 (as is the
 case for Integer.toString).  The digit-to-character mapping provided
 by Character.forDigit is used, and a minus sign is prepended if
 appropriate.  (This representation is compatible with the (String, int)
 constructor.)
<p>
</dl>
<a name="toString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toString()
</pre>
<dl>
  <dd> Returns the string representation of this number, radix 10.  The
 digit-to-character mapping provided by Character.forDigit is used,
 and a minus sign is prepended if appropriate.  (This representation
 is compatible with the (String) constructor, and allows for string
 concatenation with Java's + operator.)
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#toString()">toString</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="toByteArray()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toByteArray"><b>toByteArray</b></a>
<pre>
 public byte[] toByteArray()
</pre>
<dl>
  <dd> Returns the two's-complement representation of this number.  The array
 is big-endian (i.e., the most significant byte is in the [0] position).
 The array contains the minimum number of bytes required to represent
 the number (ceil((this.bitLength() + 1)/8)).  (This representation is
 compatible with the (byte[]) constructor.)
<p>
</dl>
<a name="intValue()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="intValue"><b>intValue</b></a>
<pre>
 public int intValue()
</pre>
<dl>
  <dd> Converts this number to an int.  Standard narrowing primitive conversion
 as per The Java Language Specification.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Number.html#intValue()">intValue</a> in class <a href="java.lang.Number.html#_top_">Number</a>
  </dl></dd>
</dl>
<a name="longValue()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="longValue"><b>longValue</b></a>
<pre>
 public long longValue()
</pre>
<dl>
  <dd> Converts this number to a long.  Standard narrowing primitive conversion
 as per The Java Language Specification.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Number.html#longValue()">longValue</a> in class <a href="java.lang.Number.html#_top_">Number</a>
  </dl></dd>
</dl>
<a name="floatValue()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="floatValue"><b>floatValue</b></a>
<pre>
 public float floatValue()
</pre>
<dl>
  <dd> Converts this number to a float.  Similar to the double-to-float
 narrowing primitive conversion defined in The Java Language
 Specification: if the number has too great a magnitude to represent
 as a float, it will be converted to infinity or negative infinity,
 as appropriate.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Number.html#floatValue()">floatValue</a> in class <a href="java.lang.Number.html#_top_">Number</a>
  </dl></dd>
</dl>
<a name="doubleValue()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="doubleValue"><b>doubleValue</b></a>
<pre>
 public double doubleValue()
</pre>
<dl>
  <dd> Converts the number to a double.  Similar to the double-to-float
 narrowing primitive conversion defined in The Java Language
 Specification: if the number has too great a magnitude to represent
 as a double, it will be converted to infinity or negative infinity,
 as appropriate.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Number.html#doubleValue()">doubleValue</a> in class <a href="java.lang.Number.html#_top_">Number</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.math.html">This Package</a>  <a href="java.math.BigDecimal.html#_top_">Previous</a>  <a href="Package-java.math.html">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
