Here you can find the source of clamp(double value, double min, double max)
Parameter | Description |
---|---|
value | a parameter |
min | a parameter |
max | a parameter |
public static double clamp(double value, double min, double max)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j av a 2 s. c o m*/ * Clamp a value to the given range * * @param value * @param min * @param max * @return */ public static double clamp(double value, double min, double max) { return Math.max(min, Math.min(max, value)); } }