Java BigInteger xor() MethodLast Updated : 17 Mar 2025 The xor() method of Java BigInteger class is used to find the Bitwise XOR of two BigIntegers. This method returns a BigInteger whose value is (this ^ val). Syntax:Parameter:val - value to be XOR'ed with this BigInteger. Returns:This method returns this ^ val. Exception:NA Note: This method returns a negative BigInteger if and only if exactly one of this and val are negative.Example 1Output: XOR operation on 5 and 2 gives 7 Example 2Output: XOR operation on 5 and -2 gives -5 Example 3Output: XOR operation on -5 and -2 gives 5 Next TopicJava biginteger sqrt method |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India