boolean (long cutoff) { long bottom = myFrom - 1 - remainder(myFrom - 1, myMod) + myMod; long top = myTo - remainder(myTo, myMod); if (bottom >= myFrom && top > bottom && myTo >= top) { int count = Long.bitCount(myBits); long wholeCount = (top / myMod - bottom / myMod) * count; if (wholeCount < 0 || wholeCount > cutoff) return true; for (long i = myFrom; i < bottom; i++) { if (isSet(myBits, remainder(i, myMod))) wholeCount++; } for (long i = top; i <= myTo; i++) { if (isSet(myBits, remainder(i, myMod))) wholeCount++; } return wholeCount < 0 || wholeCount > cutoff; } return stream().limit(Math.max(0, cutoff + 1)).count() > cutoff; }