class ExponentialBackOff implements BackOff {

  @Override
  public long getBackOffInMillis() {
    if (++numberOfRetries > maximumRetries) {
      return -1;
    }
    
    double delta = randomizationFactor * currentIntervalMillis;
    double minInterval = currentIntervalMillis - delta;
    double maxInterval = currentIntervalMillis + delta;
    long interval = (long) (minInterval + (Math.random() * (maxInterval - minInterval + 1)));
    
    if (currentIntervalMillis >= maximumIntervalMillis / multiplier) {
      currentIntervalMillis = maximumIntervalMillis;
    } else {
      currentIntervalMillis *= multiplier;
    }
    
    return interval;
  }

  public  ExponentialBackOff();
  public  ExponentialBackOff(Builder builder);

}