code: public int[] toArray() {
          int i, ele;
          int[] result;
  
          result = new int[size()];
          for (ele = first(), i = 0; ele != -1; ele = next(ele), i++) {
              result[i] = ele;
          }
          return result;
      }
docs: Creates an array with all elements of the set.
  @return   array with all elements of the set