Retrieve the sets as 2D-array of ints.

@return the sets
13712
public int[][] getSets() {
        int n = 0;
        for (int i = 0; i < forest.length; i++) {
            if (forest[i] < 0) {
                n++;
            }
        }
        int[][] sets = new int[n][];
        int currentSet = 0;
        for (int i = 0; i < forest.length; i++) {
            if (forest[i] < 0) {
                int setSize = 1 - forest[i] - 1;
                sets[currentSet] = new int[setSize];
                int currentIndex = 0;
                for (int element = 0; element < forest.length; element++) {
                    if (getRoot(element) == i) {
                        sets[currentSet][currentIndex] = element;
                        currentIndex++;
                    }
                }
                currentSet++;
            }
        }
        return sets;
    }
914168
public AbstractInsnNode[] toArray() {
        int i = 0;
        AbstractInsnNode elem = first;
        AbstractInsnNode[] insns = new AbstractInsnNode[size];
        while (elem != null) {
            insns[i] = elem;
            elem.index = i++;
            elem = elem.next;
        }
        return insns;
    }
228458
int[][] paths() {
        int[][] paths = new int[this.paths.size()][0];
        for (int i = 0; i < this.paths.size(); i++) {
            paths[i] = this.paths.get(i);
        }
        return paths;
    }
956677
public int size() {
        // Since the sets are disjoint, we can simple sum their sizes
        int size = 0;
        for (Set<T> s : sets)
            size += s.size();
        return size;
    }
580791
public int[] toArray() {
    int[] ret = new int[len];
    for(int i = 0; i < len; i++) {
      ret[i] = buf[i];
    }
    return ret;
  }
1013813
public int[] toIntArray()
    {
        final int[] result = new int[this.size()];
        this.forEachWithIndex(new IntIntProcedure()
        {
            public void value(int each, int index)
            {
                result[index] = each;
            }
        });
        return result;
    }
96493
public int[] getElementIndices() {
        Integer[] indices = indexToValue.keySet().toArray(new Integer[0]);
        int[] primitive = new int[indices.length];
        for (int i = 0; i < indices.length; ++i)
            primitive[i] = indices[i].intValue();
        return primitive;
    }
300861
@Pure
	public SortedSet<Integer> toSortedSet() {
		final SortedSet<Integer> theset = new TreeSet<>();
		if (this.values != null) {
			for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) {
				for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) {
					theset.add(n);
				}
			}
		}
		return theset;
	}
36219
public Set<Algorithm> getAlgorithms() {
		if (algorithms == null) {
			algorithms = Collections.unmodifiableSet(new HashSet<>(
					this.idsToAlgorithms.values()));
		}
		return algorithms;
	}
1117654
int[] toIntArray() {
		final int size = finish - start;
		final int length = (size + 31) >> 5;
		final int[] ints = new int[length];
		if (length == 0) return ints;
		if ((start & ADDRESS_MASK) == 0) {
			int i = start >> ADDRESS_BITS;
			int j = length; // how many ints we have to process
			for (; j > 2; i++) {
				final long l = bits[i];
				ints[--j] = (int) (l      );
				ints[--j] = (int) (l >> 32);
			}
			if (j > 0) {
				final long m = -1L >>> (ADDRESS_SIZE - finish & ADDRESS_MASK);
				final long l = bits[i] & m;
				for (int k = 0; j > 0; k++) {
					ints[--j] = (int) (l >> (k*32));
				}
			}
		} else { // general case
			int i = 0;
			for (; i < length - 1; i++) {
				ints[length - 1 - i] = (int) getBitsAdj(start + (i << 5), 32);
			}
			ints[0] = (int) getBitsAdj(start + (i << 5), size - (i << 5));
		}
		return ints;
	}
62406
public final Set<K> keySet() {
		try {
			Set<K> set = new HashSet<K>();
			listFilesToSet(getPath(), set);
			return set;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
1015163
public ArrayContainer toArrayContainer() {
    ArrayContainer ac = new ArrayContainer(cardinality);
    ac.loadData(this);
    if (ac.getCardinality() != cardinality) {
      throw new RuntimeException("Internal error.");
    }
    return ac;
  }
738263
public int[] getValues() {
        int[] graylevel = new int[size];
        int[] values1D = convertToArray();
        for( int i = 0; i < size; i++ ) {
            graylevel[i] = values1D[i] & 0x000000ff;
        }
        return graylevel;
    }
616943
public double[][] copyValues2D()
    {
        double v[][] = new double[nRows][nCols];

        for (int r = 0; r < nRows; ++r) {
            for (int c = 0; c < nCols; ++c) {
                v[r][c] = values[r][c];
            }
        }

        return v;
    }
609438
static int[] toIntArray(List<Integer> integers) {
		int[] ints = new int[integers.size()];
		int i = 0;
		for (Integer n : integers) {
			ints[i++] = n;
		}
		return ints;
	}
923189
public static IntSet and (IntSet... sets)
    {
        checkNotNull(sets);
        IntSet result = create();
        int len = sets.length;
        if (len > 0) {
            OUTER:
            for (Interator it = sets[0].interator(); it.hasNext(); ) {
                int val = it.nextInt();
                for (int ii = 1; ii < len; ii++) {
                    if (!sets[ii].contains(val)) {
                        continue OUTER;
                    }
                }
                result.add(val);
            }
        }
        return result;
    }
932706
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;
    }