Numbers { public static Predicate<Number> inRange(final long min, final long max) { return new Predicate<Number>() { public boolean apply(Number number) { return number != null && number.longValue() >= min && number.longValue() <= max; } }; }  static Predicate<Number> inRange(final long min, final long max); static final Predicate<Number> IsZero; static final Predicate<Number> IsPositive; static final Predicate<Number> IsNegative; static final Predicate<Number> IsEven; static final Predicate<Number> IsOdd; }
@Test public void inRange() { Predicate<Number> range = Numbers.inRange(1, 5); assertTrue(range.apply(1)); assertTrue(range.apply(3)); assertTrue(range.apply(5)); assertFalse(range.apply(null)); assertFalse(range.apply(0)); assertFalse(range.apply(15)); }