### Question:
RangeSet implements IntSet { @Override public Object[] toArray() { Object[] array = new Object[size]; for (int i = 0; i < size; i++) { array[i] = i; } return array; } RangeSet(int size); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override boolean contains(int i); @Override PrimitiveIterator.OfInt iterator(); @Override int[] toIntArray(); @Override Object[] toArray(); @Override T[] toArray(T[] a); @Override boolean add(Integer integer); @Override boolean remove(Object o); @Override boolean remove(int i); @Override boolean containsAll(Collection<?> c); @Override boolean containsAll(IntSet set); @Override boolean add(int i); void set(int i); @Override boolean addAll(IntSet set); @Override boolean addAll(Collection<? extends Integer> c); @Override boolean retainAll(Collection<?> c); @Override boolean retainAll(IntSet c); @Override boolean removeAll(IntSet set); @Override boolean removeAll(Collection<?> c); @Override void clear(); @Override boolean equals(Object o); @Override IntStream intStream(); @Override void forEach(IntConsumer action); @Override void forEach(Consumer<? super Integer> action); @Override Spliterator.OfInt intSpliterator(); @Override boolean removeIf(IntPredicate filter); @Override int hashCode(); @Override String toString();  }### Answer:
@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]); }
@Test public void toArray1() throws Exception { RangeSet rs = new RangeSet(4); Object[] array = rs.toArray(new Integer[4]); assertEquals(4, array.length); assertEquals(0, array[0]); assertEquals(1, array[1]); assertEquals(2, array[2]); assertEquals(3, array[3]); }