Java BigInteger and() Method

The and() method of Java BigInteger class returns a BigInteger whose value is (this & val).

Syntax:

Parameter:

val- A value to be AND'ed with this BigInteger.

Returns:

This method returns a BigInteger object of value, this &val .

Note:This method returns a negative BigInteger if and only if this and val are both negative.

Example 1

Test it Now

Output:

Result is 1

Example 2

Test it Now

Output:

Result is -7

Example 3

Test it Now

Output:

esult is 5

Next TopicJava BigInteger




Latest Courses