xor(BitSet): This method is available in java.util.BitSet class of Java.
Syntax:
void java.util.BitSet.xor(BitSet set)
This method takes one argument of the type BitSet as its parameter. This method performs a logical XOR of this bit set with the bit set argument.
Parameters: One parameter is required for this method.
set: a bit set.
Returns: NA
Exceptions: NA
Approach
Java
import java.util.BitSet;public class BitSetxor {public static void main(String[] args) {BitSet bitSet = new BitSet(100);bitSet.set(1);bitSet.set(50);bitSet.set(6);bitSet.set(10);BitSet bitSet2 = new BitSet(100);bitSet2.set(1);bitSet2.set(5);bitSet2.set(6);bitSet2.set(16);bitSet.xor(bitSet2);System.out.println(bitSet);}}
Output:
{5, 10, 16, 50}
No comments:
Post a Comment