Range { public int[] getRangeValues() { List<Integer> rangeList = new ArrayList<Integer>(); for (int i = start; i <= end; i++) { boolean excluded = false; for (Range range : excludes) { if (range.contains(i)) { excluded = true; break; } } if (!excluded) { rangeList.add(i); } } int[] rangeArray = new int[rangeList.size()]; for (int i = 0; i < rangeArray.length; i++) { rangeArray[i] = rangeList.get(i); } return rangeArray; } Range();  Range(int start, int end);  Range(int start, int end, Range exclude);  Range(int start, int end, List<Range> excludes);  Range(Range range); boolean contains(int value); int[] getRangeValues(); int getStart(); @ConfigurationProperty(name = "start", label = "Start", description = "The start of the range") void setStart(int start); int getEnd(); @ConfigurationProperty(name = "end", label = "End", description = "The end of the range") void setEnd(int end); void addExclude(Range exclude); void removeExclude(Range exclude); List<Range> getExcludes(); @ConfigurationProperty(name = "excludes", label = "Excludes Ranges", description = "The ranges the exclude from this range", required = false) void setExcludes(List<Range> excludes); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testGetRangeValues() { assertArrayEquals(new int[] { 1, 2, 3, 4, 5 }, range.getRangeValues()); Range range2 = new Range(0, 7, range); assertArrayEquals(new int[] { 0, 6, 7 }, range2.getRangeValues()); }