xor(): This method is available in java.math.BigInteger class of Java.
Syntax:
BigInteger java.math.BigInteger.xor(BigInteger val)
This method takes one argument of type BigInteger as its parameter. This method returns a BigInteger whose value is (this ^ val). (This method returns a negative BigInteger if and only if exactly one of this and val are negative.)
Parameters: One parameter is required for this method.
val: value to be XOR'ed with this BigInteger.
Returns: this ^ val
For Example:
BigInteger bigInteger = new BigInteger("1234")
BigInteger val = new BigInteger("123")
bigInteger.xor(val) = > It returns 1193
Approach
Java
import java.math.BigInteger;public class BigIntegerxor {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("1234");BigInteger val = new BigInteger("123");System.out.println(bigInteger.xor(val));}}
Output:
1193
No comments:
Post a Comment