title: Does BitSet in java stores bits or integers?
body: <p>I came across many coding sites about bitset. But i cant understand whether it stores bits or integers.</p>
  
  <p>BitSet creates an array of bits represented by boolean values.</p>
  
  <pre><code>import java.util.*; 
  public class GFG 
  { 
      public static void main(String[] args) 
      { 
         BitSet bs1 = new BitSet(); 
         BitSet bs2 = new BitSet(6); 
  
         bs1.set(0); 
         bs1.set(1); 
         bs1.set(2); 
         bs1.set(4); 
  
         bs2.set(4); 
         bs2.set(6); 
         bs2.set(5); 
         bs2.set(1); 
         bs2.set(2); 
         bs2.set(3); 
  
         System.out.println("bs1  : " + bs1); 
         System.out.println("bs2  : " + bs2); 
      } 
  } 
  Output:
  
  bs1 : {0, 1, 2, 4}
  bs2 : {1, 2, 3, 4, 5, 6}
  </code></pre>
  
  <p>BitSet stores bits or integers?</p>
  
  <p>How does it stores that in memory?</p>
  
  <p>How the values change when any manipulation is done?</p>