Here you can find the source of inRange(int checkValue, int min, int max)
public static int inRange(int checkValue, int min, int max)
//package com.java2s; // The MIT License (MIT) public class Main { public static int inRange(int checkValue, int min, int max) { if (checkValue < min) { return min; }//from w w w . j a v a 2 s . c om if (checkValue > max) { return max; } return checkValue; } public static double inRange(double checkValue, double min, double max) { if (checkValue < min) { return min; } if (checkValue > max) { return max; } return checkValue; } }