code: public static double clamp(double value, double min, double max)
      {
          final double fixed;
          if (value < min)
          {
              fixed = min;
          }
          else if (value > max)
          {
              fixed = max;
          }
          else
          {
              fixed = value;
          }
          return fixed;
      }
docs: Fix a value between an interval.
  
  @param value The value to fix.
  @param min The minimum value.
  @param max The maximum value.
  @return The fixed value.