static Bits joinBits(Collection l) { if (empty(l)) ret new Bits; new Bits bits; for (Bits b : l) appendBits(bits, b); ret bits; } static Bits joinBits(Bits a, Bits b) { if (a == null) ret b; if (b == null) ret a; int n = a.n; BitSet bs = b.bs; Bits c = new Bits(cloneBitSet(a.bs), n+b.n); BitSet bs2 = c.bs; for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) bs2.set(n+i); ret c; }