public static void isBetween ( Integer value , int min , int max , String name ) { notNull ( value , name ) ; if ( value < min || value > max ) { throw new IllegalArgumentException ( name + "(" + value + ") out of range: " + min + " <= " + name + " <= " + max ) ; } }
Checks that i is not null and is in the range min &lt ; = i &lt ; = max .