### Question:
OSMIDMap implements LongIntMap { static long binarySearch(DataAccess da, long start, long len, long key) { long high = start + len, low = start - 1, guess; byte[] longBytes = new byte[8]; while (high - low > 1) { guess = (high + low) >>> 1; long tmp = guess << 3; da.getBytes(tmp, longBytes, 8); long guessedKey = bitUtil.toLong(longBytes); if (guessedKey < key) low = guess; else high = guess; } if (high == start + len) return ~(start + len); long tmp = high << 3; da.getBytes(tmp, longBytes, 8); long highKey = bitUtil.toLong(longBytes); if (highKey == key) return high; else return ~high; } OSMIDMap(Directory dir);  OSMIDMap(Directory dir, int noNumber); void remove(); @Override int put(long key, int value); @Override int get(long key); @Override long getSize(); long getCapacity(); @Override int getMemoryUsage(); @Override void optimize();  }### Answer:
@Test public void testBinSearch() { DataAccess da = new RAMDirectory().find(""); da.create(100); da.setInt(0 * 4, 1); da.setInt(1 * 4, 0); da.setInt(2 * 4, 5); da.setInt(3 * 4, 0); da.setInt(4 * 4, 100); da.setInt(5 * 4, 0); da.setInt(6 * 4, 300); da.setInt(7 * 4, 0); da.setInt(8 * 4, 333); da.setInt(9 * 4, 0); assertEquals(2, OSMIDMap.binarySearch(da, 0, 5, 100)); assertEquals(3, OSMIDMap.binarySearch(da, 0, 5, 300)); assertEquals(~3, OSMIDMap.binarySearch(da, 0, 5, 200)); assertEquals(0, OSMIDMap.binarySearch(da, 0, 5, 1)); assertEquals(1, OSMIDMap.binarySearch(da, 0, 5, 5)); }