Example for Javolution FastBitSet
Javolution is a High-performence java library, it is not only fast but also very comfortable to use.
FastBitSet of Javolution is similar to BitSet of Java native Bib. But there are still some differences in usage:
1. BitSet is cloneable, but FastBitSet not.
2. FastBitSet has an own Number Class: Index
public static void main(String[] args) { FastBitSet fbs = new FastBitSet(); fbs.set(300); fbs.set(200); fbs.set(450); // copy a FastBitSet FastBitSet fbs2 = new FastBitSet(); fbs2.addAll(fbs); // print all the data in FastBitSet for(int i=fbs.nextSetBit(0); i>=0; i=fbs.nextSetBit(i+1)){ System.out.println(i); } // Example for how to use "toArray" Index[] arr = fbs.toArray(new Index[0]); for(Index i : arr){ System.out.println(i); } }