The BitSet class implements the Cloneable interface, providing you with a clone() method.
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);
BitSet bitSetClone = (BitSet) bites.clone();
System.out.println(bites);
System.out.println(bitSetClone);
}
}
{0, 1, 2, 3}
{0, 1, 2, 3}