Here you can find the source of minMax(int value, int min, int max)
public static int minMax(int value, int min, int max)
//package com.java2s; //License from project: Apache License public class Main { public static int minMax(int value, int min, int max) { return Math.max(min, Math.min(max, value)); }/*from w ww. ja va 2s .c o m*/ public static int max(int... values) { int max = Integer.MIN_VALUE; for (int value : values) { if (value > max) { max = value; } } return max; } public static int min(int... values) { int min = Integer.MAX_VALUE; for (int value : values) { if (value < min) { min = value; } } return min; } }