(int fromIndex, boolean bitClear)
| 179 | } |
| 180 | |
| 181 | private int nextBit(int fromIndex, boolean bitClear) { |
| 182 | int pos = longPosition(fromIndex); |
| 183 | if (pos >= bits.length) { |
| 184 | return -1; |
| 185 | } |
| 186 | int current = fromIndex; |
| 187 | do { |
| 188 | long currValue = bits[pos]; |
| 189 | if (currValue == 0) { |
| 190 | pos++; |
| 191 | current = pos << BITS_PER_LONG_SHIFT; |
| 192 | } else { |
| 193 | do { |
| 194 | long bitPos = bitPosition(current); |
| 195 | if (((currValue & bitPos) != 0) ^ bitClear) { |
| 196 | return current; |
| 197 | } else { |
| 198 | current++; |
| 199 | } |
| 200 | } while (current % BITS_PER_LONG != 0); |
| 201 | } |
| 202 | pos++; |
| 203 | } while (pos < bits.length); |
| 204 | |
| 205 | return -1; |
| 206 | } |
| 207 | |
| 208 | public int nextClearBit(int fromIndex) { |
| 209 | return nextBit(fromIndex, true); |
no test coverage detected