Java BitSet xor() methodThe xor(BitSet set) method of Java BitSet class is used to perform a logical XOR operation on the set bits of this set with specified set argument. The value of bit set is modified so that each bit in it has true if and only if any one of the following statements satisfies:
Syntax:Parameter:
Returns:NA Exception:NullPointerException -If null parameter will pass in the method. Compatibility Version:Java 1.0 and above Example 1Output: bitset1: {0, 1, 4, 6, 7} bitset2: {2, 4, 6, 8, 10} xor operation between bitsets: {0, 1, 2, 7, 8, 10} Example 2This method throws a NullPointerException if we pass a null parameter. Output: Exception in thread "main" java.lang.NullPointerException at java.util.BitSet.xor(Unknown Source) at BitSetXorExample2.main(BitSetXorExample2.java:15) bitset1: {0, 1, 4, 6, 7} Next TopicJava-bitset-valueof-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India