public static BitChromosome of(
		final BitSet bits,
		final int length,
		final double p
	) {
		final var array = BitArray.ofLength(length);
		for (int i = 0; i < length; ++i) {
			if (bits.get(i)) {
				array.set(i, true);
			}
		}

		return new BitChromosome(array, probability(p));
	}
Create a new {@code BitChromosome} with the given parameters.

@param length length of the BitChromosome.
@param bits the bit-set which initializes the chromosome
@param p Probability of the TRUEs in the BitChromosome.
@return a new {@code BitChromosome} with the given parameter
@throws NegativeArraySizeException if the {@code length} is smaller than
        one.
@throws NullPointerException if the {@code bitSet} is {@code null}.
@throws IllegalArgumentException if {@code p} is not a valid probability.
jenetics/src/main/java/io/jenetics/BitChromosome.java