Java BigInteger or() Method

The or() method of Java BigInteger class is used to find the Bitwise OR of two BigIntegers. This method returns a BigInteger whose value is (this | val).

Syntax:

Parameter:

val - value to be OR'ed with this BigInteger.

Returns:

This method returns (this | val).

Exception:

NA

Note: This method returns a negative BigInteger if and only if either this or val is negative.

Example 1

Test it Now

Output:

OR operation on 8 and 2 gives 10

Example 2

Test it Now

Output:

OR operation on 8 and -2 gives -2  

Example 3

Test it Now

Output:

OR operation on -8 and -2 gives -2  

Next TopicJava BigInteger




Latest Courses