Here you can find the source of inRange(E element, E min, E max)
public static <E extends Comparable<E>> boolean inRange(E element, E min, E max)
//package com.java2s; //License from project: LGPL public class Main { public static <E extends Comparable<E>> boolean inRange(E element, E min, E max) { int toMin = element.compareTo(min); int toMax = element.compareTo(max); return toMin == 0 ? true : toMin < 0 ? false : toMax == 0 ? true : toMax > 0 ? false : true; }/* ww w.j a v a2 s . c o m*/ }