public int advance(int target) {upto++;if (upto == docIDs.length) {return docID = NO_MORE_DOCS;}int inc = 10;int nextUpto = upto+10;int low;int high;while (true) {if (nextUpto >= docIDs.length) {low = nextUpto-inc;high = docIDs.length-1;break;}if (target <= docIDs[nextUpto]) {low = nextUpto-inc;high = nextUpto;break;}inc *= 2;nextUpto += inc;}while (true) {if (low > high) {upto = low;break;}int mid = (low + high) >>> 1;int cmp = docIDs[mid] - target;if (cmp < 0) {low = mid + 1;} else if (cmp > 0) {high = mid - 1;} else {upto = mid;break;}}if (upto == docIDs.length) {return docID = NO_MORE_DOCS;} else {return docID = docIDs[upto];}}