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
abs(): It returns a BigInteger whose value is the absolute value of this BigInteger.
add(): It returns a BigInteger whose value is (this + val).
and(): It returns a BigInteger whose value is (this & val).
andNot(): It returns a BigInteger whose value is (this & ~val).
bitCount(): It returns the number of bits in the two's complement representation of this BigInteger that differs from its sign bit.
bitLength(): It returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.
byteValue(): It returns the value of the specified number as a byte.
byteValueExact(): It converts this BigInteger to a byte, checking for lost information.
clearBit(): It returns a BigInteger whose value is equivalent to this BigInteger with the designated bit cleared.(Computes (this & ~(1<<n)).)
compareTo(): It compares this BigInteger with the specified BigInteger.
divide(): It returns a BigInteger whose value is (this / val).
divideAndRemainder(): It returns an array of two BigIntegers containing (this / val)followed by (this % val).
doubleValue(): It converts this BigInteger to a double.
equals(): It compares this BigInteger with the specified Object for equality.
flipBit(): It returns a BigInteger whose value is equivalent to this BigInteger with the designated bit flipped (Computes (this ^ (1<<n))).
floatValue(): It converts this BigInteger to float.
gcd(): It returns a BigInteger whose value is the greatest common divisor of abs(this) and abs(val).
getLowestSetBit(): It 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).
hashCode(): It returns the hash code for this BigInteger.
intValue(): It converts this BigInteger to an int.
intValueExact(): It converts this BigInteger to an int, checking for lost information. If the value of this BigIntegeris out of the range of the int type, then an ArithmeticException is thrown.
isProbablePrime(): It returns true if this BigInteger is probably prime, false if it's definitely composite.
longValue(): It converts this BigInteger to long.
longValueExact(): It converts this BigInteger to a long, checking for lost information.
max(): It returns the maximum of this BigInteger and val.
min(): It returns the minimum of this BigInteger and val.
mod(): It returns a BigInteger whose value is (this mod m).
modInverse(): It returns a BigInteger whose value is (this^-1 mod m).
modPow(): It returns a BigInteger whose value is (this^exponent mod m).
multiply(): It returns a BigInteger whose value is (this * val).
Some More Methods of BigInteger Class
No comments:
Post a Comment