public static InvertibleCodec<int[], EnumGene<Integer>>
	ofPermutation(final int length) {
		Requires.positive(length);

		final PermutationChromosome<Integer> chromosome =
			PermutationChromosome.ofInteger(length);

		final Map<Integer, EnumGene<Integer>> genes = chromosome.stream()
			.collect(Collectors.toMap(EnumGene::allele, identity()));

		return InvertibleCodec.of(
			Genotype.of(chromosome),
			gt -> gt.chromosome().stream()
				.mapToInt(EnumGene::allele)
				.toArray(),
			val -> Genotype.of(
				new PermutationChromosome<>(
					IntStream.of(val)
						.mapToObj(genes::get)
						.collect(ISeq.toISeq())
				)
			)
		);
	}
Create a permutation {@link InvertibleCodec} of integer in the range
{@code [0, length)}.

@param length the number of permutation elements
@return a permutation {@code Codec} of integers
@throws IllegalArgumentException if the {@code length} is smaller than
        one.
jenetics/src/main/java/io/jenetics/engine/Codecs.java