Here you can find the source of clamp(double var1, double var2, double var3)
public static double clamp(double var1, double var2, double var3)
//package com.java2s; //License from project: Apache License public class Main { public static double clamp(double var1, double var2, double var3) { if (var1 > var3) { var1 = var3; }//from ww w . j a va2 s. c o m if (var1 < var2) { var1 = var2; } return var1; } }