@Override
	public int[] next() throws NoSuchElementException {
		formNextPermutation();
		int i = size - 1;
		while (permutationIndexes[i] > permutationIndexes[i + 1]) {
			i--;
		}
		if (i == 0) {
			next = false;
			for (int j = 0; j < size + 1; j++) {
				permutationIndexes[j] = j;
			}
			return outputPermutationIndexes;
		}
		int j = size;
		while (permutationIndexes[i] > permutationIndexes[j]) {
			j--;
		}
		swap(permutationIndexes, i, j);
		int r = size;
		int s = i + 1;
		while (r > s) {
			swap(permutationIndexes, r, s);
			r--;
			s++;
		}
		return outputPermutationIndexes;
	}