Here you can find the source of clamp(double f, double f1, double f2)
public static double clamp(double f, double f1, double f2)
//package com.java2s; //License from project: LGPL public class Main { public static double clamp(double f, double f1, double f2) { return f < f1 ? f1 : (f > f2 ? f2 : f); }/* ww w . j av a 2 s. c o m*/ }