public static double clamp(double value,double low,double high){
  return Math.min(Math.max(value,low),high);
}

public static double clamp ( double value , double low , double high ) { return Math . min ( Math . max ( value , low ) , high ) ; }
clamp a value to be within the provided range .
