Java tutorial
//package com.java2s; import java.util.BitSet; public class Main { public static BitSet bitSetOfIndexes(int... indexes) { BitSet bitSet = new BitSet(); for (int index : indexes) { bitSet.set(index); } return bitSet; } }