@Override
   public Object[] toArray() {
      Object[] array = new Object[size];
      for (int i = 0; i < size; i++) {
         array[i] = i;
      }
      return array;
   }
@Test
   public void toArray() throws Exception {
      RangeSet rs = new RangeSet(4);
      Object[] array = rs.toArray();
      assertEquals(4, array.length);
      assertEquals(0, array[0]);
      assertEquals(1, array[1]);
      assertEquals(2, array[2]);
      assertEquals(3, array[3]);
   }