Spidey
Spidey

Reputation: 9

How to join two bitsets in Java?

I have BitSet1 - {2,4,6,8} and another BitSet2 - {10,20}. How to combine the two Bitsets and get the final BitSet as {2,4,6,8,10,20}. Please help ?

Upvotes: 0

Views: 1387

Answers (1)

michid
michid

Reputation: 10814

Use BitSet.or(BitSet) to include all elements of the bit set passed as argument into the current bit set.

Upvotes: 6

Related Questions