public static Double calculateCurrentBurnRate(List<Datapoint> dpList){
  if (dpList.size() <= 7) {
    return null;
  }
  Datapoint dayOldDatapoint=dpList.get(dpList.size() - 7);
  Datapoint latestDatapoint=dpList.get(dpList.size() - 1);
  for (  Datapoint datapoint : dpList.subList(dpList.size() - 6,dpList.size() - 1)) {
    if (latestDatapoint.getAverage() > dayOldDatapoint.getAverage()) {
      break;
    }
    dayOldDatapoint=datapoint;
  }
  double currentBurnRate=(latestDatapoint.getAverage() - dayOldDatapoint.getAverage()) / getDateDifference(dayOldDatapoint.getTimestamp(),latestDatapoint.getTimestamp(),TimeUnit.HOURS);
  currentBurnRate=(currentBurnRate < 0 ? 0 : currentBurnRate);
  return currentBurnRate;
}

public static Double calculateCurrentBurnRate ( List < Datapoint > dpList ) { if ( dpList . size ( ) <= 7 ) { return null ; } Datapoint dayOldDatapoint = dpList . get ( dpList . size ( ) - 7 ) ; Datapoint latestDatapoint = dpList . get ( dpList . size ( ) - 1 ) ; for ( Datapoint datapoint : dpList . subList ( dpList . size ( ) - 6 , dpList . size ( ) - 1 ) ) { if ( latestDatapoint . getAverage ( ) > dayOldDatapoint . getAverage ( ) ) { break ; } dayOldDatapoint = datapoint ; } double currentBurnRate = ( latestDatapoint . getAverage ( ) - dayOldDatapoint . getAverage ( ) ) / getDateDifference ( dayOldDatapoint . getTimestamp ( ) , latestDatapoint . getTimestamp ( ) , TimeUnit . HOURS ) ; currentBurnRate = ( currentBurnRate < 0 ? 0 : currentBurnRate ) ; return currentBurnRate ; }
calculate the current burn rate , given a list of datapoints from amazon aws .
