@Test public void basicTest() { BitSet a = BitSets.valueOf(new int[] { 1, 3, 10 }); assertEquals(3, a.cardinality()); assertTrue(10 < a.size()); assertTrue(a.get(3)); }
public static BitSet valueOf(int[] indexes) { if (indexes == null || indexes.length == 0) { return new BitSet(); } int maxIndex = Integer.MIN_VALUE; for (int index : indexes) { maxIndex = Math.max(maxIndex, index); } BitSet set = new BitSet(maxIndex); for (int index : indexes) { set.set(index); } return set; }
BitSets { public static BitSet valueOf(int[] indexes) { if (indexes == null || indexes.length == 0) { return new BitSet(); } int maxIndex = Integer.MIN_VALUE; for (int index : indexes) { maxIndex = Math.max(maxIndex, index); } BitSet set = new BitSet(maxIndex); for (int index : indexes) { set.set(index); } return set; } }
BitSets { public static BitSet valueOf(int[] indexes) { if (indexes == null || indexes.length == 0) { return new BitSet(); } int maxIndex = Integer.MIN_VALUE; for (int index : indexes) { maxIndex = Math.max(maxIndex, index); } BitSet set = new BitSet(maxIndex); for (int index : indexes) { set.set(index); } return set; }  }
BitSets { public static BitSet valueOf(int[] indexes) { if (indexes == null || indexes.length == 0) { return new BitSet(); } int maxIndex = Integer.MIN_VALUE; for (int index : indexes) { maxIndex = Math.max(maxIndex, index); } BitSet set = new BitSet(maxIndex); for (int index : indexes) { set.set(index); } return set; }  static BitSet valueOf(int[] indexes); }
BitSets { public static BitSet valueOf(int[] indexes) { if (indexes == null || indexes.length == 0) { return new BitSet(); } int maxIndex = Integer.MIN_VALUE; for (int index : indexes) { maxIndex = Math.max(maxIndex, index); } BitSet set = new BitSet(maxIndex); for (int index : indexes) { set.set(index); } return set; }  static BitSet valueOf(int[] indexes);  }