Here you can find the source of minmax(int min, int max, int now)
public static final int minmax(int min, int max, int now)
//package com.java2s; //License from project: Open Source License public class Main { public static final int minmax(int min, int max, int now) { if (now < min) return min; if (now > max) return max; return now; }/*from w w w.ja v a2 s. c o m*/ public static final float minmax(float min, float max, float now) { if (now < min) return min; if (now > max) return max; return now; } public static final double minmax(double min, double max, double now) { if (now < min) return min; if (now > max) return max; return now; } }