All Downloads are FREE. Search and download functionalities are using the official Maven repository.

host.anzo.commons.utils.MathUtils Maven / Gradle / Ivy

package host.anzo.commons.utils;

import org.jetbrains.annotations.NotNull;

/**
 * @author ANZO
 * @since 9/11/2024
 */
public class MathUtils {
	public static > T clamp(@NotNull T value, T min, T max) {
		if (value.compareTo(min) < 0) {
			return min;
		} else if (value.compareTo(max) > 0) {
			return max;
		} else {
			return value;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy