public static List<Integer> createRanges(int... startEnds){
  assert startEnds.length % 2 == 0;
  ArrayList<Integer> ret=new ArrayList<Integer>();
  for (int si=0; si < startEnds.length; si++) {
    final int start=startEnds[si++];
    final int end=startEnds[si];
    assert end >= start;
    ret.ensureCapacity(ret.size() + ((end - start) + 1));
    for (int i=start; i <= end; i++) {
      ret.add(new Integer(i));
    }
  }
  return ret;
}

public static List < Integer > createRanges ( int ... startEnds ) { assert startEnds . length % 2 == 0 ; ArrayList < Integer > ret = new ArrayList < Integer > ( ) ; for ( int si = 0 ; si < startEnds . length ; si ++ ) { final int start = startEnds [ si ++ ] ; final int end = startEnds [ si ] ; assert end >= start ; ret . ensureCapacity ( ret . size ( ) + ( ( end - start ) + 1 ) ) ; for ( int i = start ; i <= end ; i ++ ) { ret . add ( new Integer ( i ) ) ; } } return ret ; }
create a list of integers consisting of the ranges defined by the provided argument e . g . . createranges ( 1 , 4 , 10 , 12 ) means create ranges 1 through 4 and 10 through 12 and should yield the list : 1 , 2 , 3 , 4 , 10 , 11 , 12
