public static void exponentialSleep(int attempt,int base,int max) throws InterruptedException {
  long sleepSeconds=(long)Math.min(max,Math.pow(base,attempt));
  LOG.debug(String.format("Attempt %d: sleeping for %d seconds",attempt,sleepSeconds));
  Thread.sleep(1000 * sleepSeconds);
}

public static void exponentialSleep ( int attempt , int base , int max ) throws InterruptedException { long sleepSeconds = ( long ) Math . min ( max , Math . pow ( base , attempt ) ) ; LOG . debug ( String . format ( "Attempt %d: sleeping for %d seconds" , attempt , sleepSeconds ) ) ; Thread . sleep ( 1000 * sleepSeconds ) ; }
sleep for a period of time that relates exponentially to the attempt number .
