class 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) {
            // use >>> for average or we could get an integer overflow.
            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;
    }

    public  OSMIDMap(Directory dir);
    public  OSMIDMap(Directory dir, int noNumber);

}