code: public void insert(long time) {
      if (time == MIN_VALUE) {
        time++;
      }
      total += 1L;
      for (int logSize = 0; ; logSize++) {
        ensureCapacity(logSize);
        
        int insertIndex = insert[logSize];
        long previous = boxes[insertIndex];
        boxes[insertIndex--] = time;
        if (insertIndex < min_l(logSize)) {
          insertIndex = max_l(logSize) - 1;
        }
        insert[logSize] = insertIndex;
  
        if (previous == MIN_VALUE) {
          //previous unoccupied
          long finalSize = 1L << logSize;
          if (finalSize > last) {
            last = finalSize;
          }
          return;
        } else if ((time - previous) < window) {
          //no space available - time to merge
          time = boxes[insertIndex];
          if (time == MIN_VALUE) {
            //previous expired - assume expiry of it's partner
            total -= 1L << logSize;
            return;
          } else {
            boxes[insertIndex] = MIN_VALUE;
          }
        } else {
          //previous aged out - decrement size
          total -= 1L << logSize;
          return;
        }
      }
    }
docs: Insert a single event at {@code time}
  
  @param time event timestamp