Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Help Java B Java BitSet

Related Tutorials


Share on Google+Share on Google+

Java BitSet

In Java, the BitSet is a class that is available in the java.util package.

Java BitSet


In Java, the BitSet is a class that is available in the java.util package.  

The BitSet object represents a vector of bits whose size can grow according to the requirement. Every bit in the bit set has a boolean value true/false.
The bits in a BitSet are indexed by the positive integers only.  All bits in the bit set initially have the false value, by default.

User can can set or clear the individual indexed bits. 

AND, logical inclusive OR, and logical exclusive OR operations can be used by one BitSet to modify the contents of another BitSet.

The BitSet class in the java.util package provides methods to access a given bit in the array with an index:

  1. get (int index)
  2. set (int index)
  3. clear (int index)
  4. flip (int index)



If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 3, 2006

Related Tutorials

Discuss: Java BitSet  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image