public static double getValueFittingBounds(double value, double highBound, double lowBound) {
		if(highBound < lowBound)
			throw new IllegalArgumentException("High bound must be greater than or equal to the lower bound.");
		
		if (value >= highBound)
			return highBound;
		else if (value <= lowBound)
			return lowBound;
		else
			return value;
	}