code: public synchronized void refill(long numTokens)
    {
      long newTokens = Math.min(capacity, Math.max(0, numTokens));
      size = Math.max(0, Math.min(size + newTokens, capacity));
    }
docs: Refills the bucket with the specified number of tokens.  If the bucket is currently full or near capacity then
  fewer than {@code numTokens} may be added.
  
  @param numTokens The number of tokens to add to the bucket.