code: public long getNearestRecordNumber(long recordNumber) {
          if (recordNumber < startingRecordNumber || recordNumber > lastRecordNumber)
              throw new IndexOutOfBoundsException();
          return (startingRecordNumber + step * ((recordNumber - startingRecordNumber) / step));
      }
docs: Returns the record number, which is nearest (from the left side, i.e. smaller) to the specified record number.
  
  @param recordNumber number of record
  @return record number, which is nearest (from the left side, i.e. smaller) to the specified record number