Here is a brief list of bugs/issues that was found while writing FormatableBitSetTest.java:
1) The two-arg constructor fails if given a size arg that is smaller than the size of the byte array arg
2) When the copy constructor is used to copy an empty bitset with a null byte array, the resulting copy has a non-null byte array
3) It is legal to call grow(int) with an arg that is smaller that the bitset's current size, but the size of the bitset remains the same.
4) It is legal to call grow(int) with a negative argument, but the size of the bitset remains the same.
5) Shrinking an empty bitset to size 0 causes an AssertFailure
6) It is legal to call shrink(int) with an arg that is larger that the bitset's current size, but the size of the bitset remains the same.
7) Shrinking an ordinary bitset to size 0 causes an AssertFailure
8) The return value of compare doesn't match what is stated in the javadoc for the method
9) The concatenate method does not work. Concatenation of two 18 bit bitsets yields a bitset that is still 18 bits.
10) The method isSet(-1) gives an NPE for an empty bitset, but returns false for a non-empty set.
11) The method set(-1) gives an NPE for an empty bitset, but does nothing for a non-empty set.
12) The method clear(-1) gives an NPE for an empty bitset, but does nothing for a non-empty set.
13) The method anySetBit() gives an NPE for an empty bitset, -1 would be more reasonable
14) The method anySetBit(-1) is equivalent to anySetBit(), but smaller args (-2, -3) do not throw an exception, but also do not necessarily return the same value as -1
15) The method or(FormatableBitSet) accepts null as an argument and treats it as if it represents an empty bitset. and(FormatableBitSet) will throw an AssertFailure, but xor(FormatableBitSet) throws an NPE
16) The methods or(FormatableBitSet) and and(FormatableBitSet) can be used with args that are smaller or larger. xor() requires the arg to have the same size as "this"
17) readExternalFromArray does not appear to have a write counterpart. Using it on something that is wtitten with writeExternal does not seem to work