public double clamp(double value){
  return Math.min(Math.max(getMin(),value),getMax());
}

public double clamp ( double value ) { return Math . min ( Math . max ( getMin ( ) , value ) , getMax ( ) ) ; }
returns the closest value to a number that is within the range or the number itself if it already is .
