private static long limitDuration(long leaseDuration,long limit){
  if (leaseDuration == Lease.ANY || leaseDuration > limit)   leaseDuration=limit;
 else   if (leaseDuration < 0)   throw new IllegalArgumentException("negative lease duration");
  return leaseDuration;
}

private static long limitDuration ( long leaseDuration , long limit ) { if ( leaseDuration == Lease . ANY || leaseDuration > limit ) leaseDuration = limit ; else if ( leaseDuration < 0 ) throw new IllegalArgumentException ( "negative lease duration" ) ; return leaseDuration ; }
limit leaseduration by limit , and check for negative value .
