### Question:
IndexedFidReader implements FeatureIDReader, Closeable { long search(final long desired, final long minRec, final long maxRec, final long predictedRec) throws IOException { if (minRec == maxRec) { return -1; } goTo(predictedRec); hasNext(); next(); buffer.limit(buffer.capacity()); if (currentId == desired) { return currentShxIndex; } if (maxRec - minRec < 10) { return search(desired, minRec + 1, maxRec, minRec + 1); } else { long newOffset = desired - currentId; long newPrediction = predictedRec + newOffset; if (newPrediction <= minRec) { newPrediction = minRec + ((predictedRec - minRec) / 2); } if (newPrediction >= maxRec) { newPrediction = predictedRec + ((maxRec - predictedRec) / 2); } if (newPrediction == predictedRec) { return -1; } if (newPrediction < predictedRec) { return search(desired, minRec, predictedRec, newPrediction); } else { return search(desired, predictedRec, maxRec, newPrediction); } } } IndexedFidReader(final URI fixUrl, final ReadableByteChannel fixChannel,
            final RecordNumberTracker reader); long getCount(); int getRemoves(); long findFid(final String fid); void goTo(final long recno); @Override void close(); @Override boolean isClosed(); @Override boolean hasNext(); @Override String next(); int currentSHXIndex(); long getCurrentFIDIndex();  }### Answer:
@Test public void testHardToFindFid() throws Exception { final long offset = reader.search(5, 3, 7, 5); assertEquals(4, offset); }