class MathUtil {

	@Pure
	public static double clampToNearestBounds(double value, double minBounds, double maxBounds) {
		assert minBounds <= maxBounds : AssertMessages.lowerEqualParameters(1, minBounds, 2, maxBounds);
		final double center = (minBounds + maxBounds) / 2;
		if (value <= center) {
			return minBounds;
		}
		return maxBounds;
	}

	private  MathUtil();

}