Here you can find the source of clip(double value, double min, double max)
public static double clip(double value, double min, double max)
//package com.java2s; //License from project: LGPL public class Main { public static double clip(double value, double min, double max) { if (value > max) value = max;/*w w w .j a v a2 s . co m*/ else if (value < min) value = min; return value; } }