Cryptography Reference
In-Depth Information
public BigInteger setBit(int n) throws ArithmeticException
This method returns a BigInteger whose value is equivalent to this number with the des-
ignated bit set. It throws an ArithmeticException if n < 0.
public BigInteger clearBit(int n) throws ArithmeticException
This method returns a BigInteger whose value is equivalent to
this
number with the des-
ignated bit cleared. It throws an ArithmeticException if
n
< 0.
public BigInteger flipBit(int n) throws ArithmeticException
This method returns a BigInteger whose value is equivalent to
this
number with the des-
ignated bit flipped. It throws an ArithmeticException if
n
< 0.
public int getLowestSetBit()
This method returns the index of the rightmost (lowest - order) one bit in this number
(that is, the number of zero bits to the right of the rightmost one bit). It returns 1 if this
number contains no one bits.
public int bitLength()
This method returns the number of bits in the minimal two ' s - complement representation
of this number, excluding a sign bit. For positive numbers, this is equivalent to the number
of bits in the ordinary binary representation.
public int bitCount()
this
number that differ from its sign bit. This method is useful when implementing bit-vector style
sets atop BigIntegers.
This method returns the number of bits in the two
'
s
-
complement representation of
public boolean isProbablePrime(int certainty)
this
'
s definitely com-
posite. 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 method returns true if
BigInteger is probably prime, or false if it
this
1/2 t
number is prime exceeds 1
t
where
= certainty. The execution time is proportional to the value of the certainty parameter.
The test for primality here is the same one used in the constructor that generates random prob-
able primes.
public int compareTo(BigInteger val)
This method 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:
==
!=
<
Search WWH ::




Custom Search