Here you can find the source of clamp(float a, float min, float max)
public static float clamp(float a, float min, float max)
//package com.java2s; //License from project: LGPL public class Main { public static int clamp(int a, int min, int max) { return a < min ? min : (a > max ? max : a); }/*from w w w .j ava 2 s.c om*/ public static float clamp(float a, float min, float max) { return a < min ? min : (a > max ? max : a); } public static double clamp(double a, double min, double max) { return a < min ? min : (a > max ? max : a); } }