BigInteger.BigInteger

BigInteger.BigInteger

Class Overview | Class Members | This Package | All Packages

Syntax 1
public BigInteger( byte val[] ) throws NumberFormatException
Description
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.



Syntax 2
public BigInteger( int signum, byte magnitude[] ) throws NumberFormatException
Description
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).



Syntax 3
public BigInteger( String val, int radix ) throws NumberFormatException
Description
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.



Syntax 4
public BigInteger( String val ) throws NumberFormatException
Description
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.



Syntax 5
public BigInteger( int numBits, Random rndSrc ) throws IllegalArgumentException
Description
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.



Syntax 6
public BigInteger( int bitLength, int certainty, Random rnd )
Description
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.