code: public static float normalize(float val, float minVal, float maxVal) {
          if (val < minVal || val > maxVal)
              throw new IllegalArgumentException("Value must be between min and max values. [val, min, max]: [" + val + "," + minVal + ", " + maxVal + "]");
          return (val - minVal) / (maxVal - minVal);
      }
docs: Normalize value between minimum and maximum.
  
  @param val    value
  @param minVal minimum value
  @param maxVal maximum value
  @return normalized value in range <code>0..1</code>
  @throws IllegalArgumentException if value is out of range <code>[minVal, maxVal]</code>