Here you can find the source of clamp_int(int num, int min, int max)
public static int clamp_int(int num, int min, int max)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a va 2 s .com*/ * Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and * third parameters. */ public static int clamp_int(int num, int min, int max) { return num < min ? min : (num > max ? max : num); } }