Collections Java Tutorial

A BitSet is a dynamically growing array containing bits.
This dynamically growing structure has two values describing its internal dimensions: a size and a length.

public int size()
public int length()

import java.util.BitSet;
public class MainClass {
 public static void main (String args[]) {
    BitSet bites = new BitSet();
    bites.set(0);
    bites.set(1);
    bites.set(2);
    bites.set(3);
    
    System.out.println(bites.size());
    System.out.println(bites.length());
  }
}
64
4