BigInteger
- class java.math..BigInteger public class BigInteger extends Number implements Comparable Tree:java.lang.Object - java.lang.Number - java.math.BigInteger Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in two's-complement notation (like Java's primitive integer types). BigInteger provides analogues to all of Java's primitive integer operators, and all relevant methods from java.lang.Math. Additionally, BigInteger provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations. BigInteger(String) - Constructor for class java.math.BigInteger public BigInteger (String val) Translates the decimal String representation of a BigInteger into a BigInteger. The String representation consists of an optional minus sign followed by a sequence of one or more decimal digits. The character-to-digit mapping is provided by Character.digit. The String may not contain any extraneous characters (whitespace, for example).Parameters: val - decimal String representation of BigInteger.Throws: NumberFormatException - val is not a valid representation of a BigInteger.See Also: Character.digit(char, int) BigInteger(String, int) - Constructor for class java.math.BigInteger public BigInteger (String val, int radix) Translates the String representation of a BigInteger in the specified radix into a BigInteger. The String representation consists of an optional minus sign followed by a sequence of one or more digits in the specified radix. The character-to-digit mapping is provided by Character.digit. The String may not contain any extraneous characters (whitespace, for example).Parameters: val - String representation of BigInteger. - radix to be used in interpreting .radix - radix to be used in interpreting val.Throws: NumberFormatException - val is not a valid representation of a BigInteger in the specified radix, or radix is outside the range from Character.MIN_RADIX (2) to Character.MAX_RADIX (36), inclusive.See Also: Character.digit(char, int) BigInteger(byte[]) - Constructor for class java.math.BigInteger public BigInteger (byte[] val) Translates a byte array containing the two's-complement binary representation of a BigInteger into a BigInteger. The input array is assumed to be in big-endian byte-order: the most significant byte is in the zeroth element.Parameters: val - big-endian two's-complement binary representation of BigInteger.Throws: NumberFormatException - val is zero bytes long. BigInteger(int, Random) - Constructor for class java.math.BigInteger public BigInteger (int numBits, Random rnd) Constructs a randomly generated BigInteger, uniformly distributed over the range 0 to (2 - 1), inclusive. The uniformity of the distribution assumes that a fair source of random bits is provided in rnd. Note that this constructor always constructs a non-negative BigInteger.Parameters: numBits - maximum bitLength of the new BigInteger. - source of randomness to be used in computing the new BigInteger.rnd - source of randomness to be used in computing the new BigInteger.Throws: IllegalArgumentException - numBits is negative.See Also: bitLength() BigInteger(int, byte[]) - Constructor for class java.math.BigInteger public BigInteger (int signum, byte[] magnitude) Translates the sign-magnitude representation of a BigInteger into a BigInteger. The sign is represented as an integer signum value: -1 for negative, 0 for zero, or 1 for positive. The magnitude is a byte array in big-endian byte-order: the most significant byte is in the zeroth element. A zero-length magnitude array is permissible, and will result in in a BigInteger value of 0, whether signum is -1, 0 or 1.Parameters: signum - signum of the number (-1 for negative, 0 for zero, 1 for positive). - big-endian binary representation of the magnitude of the number.magnitude - big-endian binary representation of the magnitude of the number.Throws: NumberFormatException - signum is not one of the three legal values (-1, 0, and 1), or signum is 0 and magnitude contains one or more non-zero bytes. BigInteger(int, int, Random) - Constructor for class java.math.BigInteger public BigInteger (int bitLength, int certainty, Random rnd) Constructs a randomly generated positive BigInteger that is probably prime, with the specified bitLength.Parameters: bitLength - bitLength of the returned BigInteger. - a measure of the uncertainty that the caller is willing to tolerate. The probability that the new BigInteger represents a prime number will exceed ). The execution time of this constructor is proportional to the value of this parameter.certainty - a measure of the uncertainty that the caller is willing to tolerate. The probability that the new BigInteger represents a prime number will exceed (1 - 1/2). The execution time of this constructor is proportional to the value of this parameter. - source of random bits used to select candidates to be tested for primality.rnd - source of random bits used to select candidates to be tested for primality.Throws: ArithmeticException - bitLength < 2.See Also: bitLength() | ||||
Search Dictionary:
