Cryptography Reference
In-Depth Information
FIGURE 2.7
This method returns a BigInteger whose value is
this
<<
n
; that is, it shifts the binary rep-
resentation of
this
n
bits to the left.
•
public BigInteger shiftRight(int n)
This method returns a BigInteger whose value is
this
>>
n
; that is, it shifts the binary rep-
resentation of
this
n
bits to the right.
•
public BigInteger and(BigInteger val)
This method returns a BigInteger whose value is (
this
& val). It performs a bitwise AND
on the two BigIntegers.
E
XAMPLE
.
If
a
and
b
are two BigIntegers, where
a
= 1001011
base 2
b
= 1011010
base 2
then the following call
BigInteger c = a.and(b);
c
leaves
with the value 1001010
base 2
.
This method returns a negative number iff both
this
and val are negative.
•
public BigInteger or(BigInteger val)
This method returns a BigInteger whose value is (
this
| val).
E
XAMPLE
.
This method performs a bitwise OR on the two operands. So if
a
and
b
are as
defined previously; that is,
a
= 1001011
base 2
b
= 1011010
base 2
Search WWH ::
Custom Search