code: protected final int readerIndex(int n)
     {
        int lo = 0;
        int hi = readers.size() - 1;
  
        while (hi >= lo)
        {
           int mid = (lo + hi) >> 1;
           int midValue = starts[mid];
           if (n < midValue)
           {
              hi = mid - 1;
           }
           else if (n > midValue)
           {
              lo = mid + 1;
           }
           else
           {
              while (mid + 1 < readers.size() && starts[mid + 1] == midValue)
              {
                 mid++;
              }
              return mid;
           }
        }
        return hi;
     }
docs: Returns the reader index for document <code>n</code>.
  
  @param n document number.
  @return the reader index.