code: public long expire(long time) {
      for (int logSize = (Long.SIZE - 1) - numberOfLeadingZeros(last); logSize >= 0; logSize--) {
        boolean live = false;
        for (int i = min_l(logSize); i < max_l(logSize); i++) {
          long end = boxes[i];
          if (end != MIN_VALUE) {
            if ((time - end) >= window) {
              total -= 1L << logSize;
              boxes[i] = MIN_VALUE;
            } else {
              live = true;
            }
          }
        }
        if (live) {
          last = 1L << logSize;
          return count();
        }
      }
      last = 0;
      return 0;
    }
docs: Expire old events.
  
  @param time current timestamp
  @return the count following expiry