clamp

public final static Double clamp(Double n, Double min, Double max)

Ensures that n lies in the range min..max.