java.math.BigInteger
Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in two's-complement notation (like Java'sprimitive integer types). It provides analogs to all of the Java'sprimitive integer operators, and all relevant methods from java.lang.Math
BigInteger provides operations for modular arithmetic, GCDcalculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations.
Some methods of BigInteger class
negate(): It returns a BigInteger whose value is (-this).
nextProbablePrime(): It returns the first integer greater than this BigInteger that is probably prime.
not(): It returns a BigInteger whose value is (~this).
BigInteger.ONE: The BigInteger constant one.
or(): It returns a BigInteger whose value is (this | val).
pow(): It returns a BigInteger whose value is (this^exponent).
probablePrime(): It returns a positive BigInteger that is probably prime, with the specified bitLength.
remainder(): It returns a BigInteger whose value is (this % val).
setBit(): It returns a BigInteger whose value is equivalent to this BigInteger with the designated bit set. (Computes (this | (1<<n)).)
shiftLeft(): It returns a BigInteger whose value is (this << n).
shiftRight(): It returns a BigInteger whose value is (this >> n).
shortValue(): It returns the value of the specified number as a short.
shortValueExact(): It converts this BigInteger to a short, checking for lost information. If the value of this BigIntegeris out of the range of the short type, then an ArithmeticException is thrown.
signum(): It returns the signum function of this BigInteger.
sqrt(): It returns the integer square root of this BigInteger.
sqrtAndRemainder(): It returns an array of two BigIntegers containing the integer square root s of this and its remainder this - s*s, respectively.
subtract(): It returns a BigInteger whose value is (this - val).
BigInteger.TEN: The BigInteger constant ten.
testBit(): his method returns true if and only if the designated bit is set.(Computes ((this &(1<<n)) != 0).)
toByteArray(): This method returns a byte array containing the two's-complement representation of this BigInteger.
toString(): It returns the decimal String representation of this BigInteger.
toString(int radix): It returns the string representation of this BigInteger in the given radix.
BigInteger.TWO: The BigInteger constant two.
BigInteger.valueOf(): It returns a BigInteger whose value is equal to that of the specified long.
xor(): It eturns a BigInteger whose value is (this ^ val).
BigInteger.ZERO: The BigInteger constant is zero.
Some More Methods of BigInteger Class
No comments:
Post a Comment