private static int [ ] bitSetToIntVector ( BitSet ints ) { int intCount = ints . cardinality ( ) ; if ( intCount == 0 ) { return null ; } int [ ] result = new int [ intCount ] ; int nextBit = ints . nextSetBit ( 0 ) ; for ( int ii = 0 ; ii < intCount ; ii ++ ) { assert ( nextBit != - 1 ) ; result [ ii ] = nextBit ; nextBit = ints . nextSetBit ( nextBit + 1 ) ; } assert ( nextBit == - 1 ) ; return result ; }
to convert the set bits to their integer indexes .