Cryptography Reference
In-Depth Information
then the following call
BigInteger c = a.or(b);
leaves
with the value 1011011 base 2 .
This method returns a negative number iff either
c
this
or val is negative.
public BigInteger xor(BigInteger val)
This method returns a BigInteger whose value is ( this ^ val).
E XAMPLE . This method performs a bitwise exclusive OR on the two operands. So if a and
b are as defined previously; that is,
a
= 1001011 base 2
b
= 1011010 base 2
then the following call
BigInteger c = a.xor(b);
leaves
with the value 0010001 base 2 .
This method returns a negative number iff exactly one of
c
this
and val are negative.
public BigInteger not()
This method returns a BigInteger whose value is this with each bit flipped. It returns a
negative value iff this is nonnegative.
E XAMPLE .
Thus, if we are using b as defined earlier; that is,
b = 1011010 base 2 ,
then the following call
BigInteger c = b.not();
leaves
c
with the value 0100101 base 2 .
public BigInteger andNot(BigInteger val)
This method is equivalent to and(val.not()), and is provided as a convenience for mask-
ing operations. This method returns a negative number iff
this
is negative and val is posi-
tive.
public boolean testBit(int n) throws ArithmeticException
This method returns true iff the designated bit is set, and throws an ArithmeticException
if
n
< 0.
 
Search WWH ::




Custom Search