Range { public static Range toEndFrom(final int from){ Assert.assertArgGreaterThan("index must be greater than zero", from, 0); return new Range(new AbstractRange(){ private final int index = from; @Override public String toString(){ return index + "-";} @Override public boolean isWithinRange(int index){return index >= from;} }); } private  Range(); private  Range(final AbstractRange range); boolean isWithinRange(final int index); Range andOf(final int... indexes); Range andFromStartTo(final int to); Range andToEndFrom(final int from); Range andBetween(final int from, final int to); @Override String toString(); static Range of(int ... indexes); static Range fromStartTo(final int to); static Range toEndFrom(final int from); static Range between(final int from, final int to);  }
@Test public void testToEndFrom(){ assertWithinRange(Range.toEndFrom(3), 3,4,10000); assertNotWithinRange(Range.toEndFrom(3), 1,2); }