code: @Override
    public int elem2ChunkIdx(long i) {
      assert 0 <= i && i <= _len : " "+i+" < "+_len;
      int cidx = (int)(i>>H2O.LOG_CHK);
      int nc = nChunks();
      if( i >= _len ) return nc;
      if( cidx >= nc ) cidx=nc-1; // Last chunk is larger
      assert 0 <= cidx && cidx < nc;
      return cidx;
    }
docs: with a sane API (JDK has an insane API).