code: private int advanceCurrentIndexByInterval(int currentIndex, Map<Long, Double> predictionDatapoints,
                                                 Long[] timestamps, long detectionIntervalInSeconds) {
          //Projected end of interval
          long firstIntervalEndTime = timestamps[0] + detectionIntervalInSeconds;
          while (true) {
              if (currentIndex >= timestamps.length || timestamps[currentIndex] > firstIntervalEndTime) {
                  //Stop once the interval ends (or the entire metric is exhausted)
                  break;
              } else {
                  predictionDatapoints.put(timestamps[currentIndex], 0.0);
                  currentIndex += 1;
              }
          }
          return currentIndex;
      }
docs: Advances currentIndex to a point where it is one anomaly detection
  interval beyond the first timestamp. Sets the anomaly scores for
  these intermediate points to 0 in the predictions metric (since
  there is not enough data in its past for a complete interval).
  
  @param currentIndex index that gets advanced to one anomaly detection interval
  beyond the first timestamp
  @param predictionDatapoints datapoints that get filled with anomaly scores of 0
  @param timestamps sorted timestamps of the original metric
  @param detectionIntervalInSeconds anomaly detection interval
  @return new advanced value of currentIndex