private static int[] partition(final int size, final int parts) {
		if (size < 1) {
			throw new IllegalArgumentException(
				"Size must greater than zero: " + size
			);
		}
		if (parts < 1) {
			throw new IllegalArgumentException(
				"Number of partitions must greater than zero: " + parts
			);
		}

		final int pts = Math.min(size, parts);
		final int[] partition = new int[pts + 1];

		final int bulk = size/pts;
		final int rest = size%pts;
		assert (bulk*pts + rest) == size;

		for (int i = 0, n = pts - rest; i < n; ++i) {
			partition[i] = i*bulk;
		}
		for (int i = 0, n = rest + 1; i < n; ++i) {
			partition[pts - rest + i] = (pts - rest)*bulk + i*(bulk + 1);
		}

		return partition;
	}
Return an array with the indexes of the partitions of an array with the
given size. The length of the returned array is {@code min(size, prts) + 1}.
<p>
Some examples:
<pre>
	 partition(10, 3): [0, 3, 6, 10]
	 partition(15, 6): [0, 2, 4, 6, 9, 12, 15]
	 partition(5, 10): [0, 1, 2, 3, 4, 5]
</pre>

The following examples print the start index (inclusive) and the end
index (exclusive) of the {@code partition(15, 6)}.
{@snippet lang="java":
int[] parts = partition(15, 6);
for (int i = 0; i < parts.length - 1; ++i) {
    System.out.println(i + ": " + parts[i] + "\t" + parts[i + 1]);
}
}
<pre>
	 0: 0 	2
	 1: 2 	4
	 2: 4 	6
	 3: 6 	9
	 4: 9 	12
	 5: 12	15
</pre>

This example shows how this can be used in a concurrent environment:
{@snippet lang="java":
try (final Concurrency c = Concurrency.start()) {
     final int[] parts = arrays.partition(population.size(), _maxThreads);

     for (int i = 0; i < parts.length - 1; ++i) {
         final int part = i;
         c.execute((Runnable)() -> {
             for (int j = parts[part + 1]; --j <= parts[part]; ) {
                 population.get(j).evaluate();
             }
         });
     }
 }
}

@param size the size of the array to partition.
@param parts the number of parts the (virtual) array should be partitioned.
@return the partition array with the length of {@code min(size, parts) + 1}.
@throws IllegalArgumentException if {@code size} or {@code p} is less than one.
jenetics/src/main/java/io/jenetics/util/PartitionBatchExecutor.java