Here you can find the source of between(T subject, T lower, T upper, boolean exclLowerEnd, boolean exclUpperEnd)
public static <T extends Comparable<? super T>> boolean between(T subject, T lower, T upper, boolean exclLowerEnd, boolean exclUpperEnd)
//package com.java2s; public class Main { public static <T extends Comparable<? super T>> boolean between(T subject, T lower, T upper, boolean exclLowerEnd, boolean exclUpperEnd) { if (subject == null) return false; boolean validExclEnds = (lower == null ? true : lower.compareTo(subject) < 0) && (upper == null ? true : upper.compareTo(subject) > 0); return validExclEnds || (!exclLowerEnd && subject.equals(lower)) || (!exclUpperEnd && subject.equals(upper)); }//from ww w. j ava2s .c o m public static <T extends Comparable<? super T>> boolean between(T subject, T lower, T upper) { return between(subject, lower, upper, false, false); } }