populationSizeMax = Integer.MAX_VALUE;
long primarySexRation = Math.round((nrOfMales / nrOfFemales) * 100.0);
double nrOfMales = (populationSize * primarySexRatio) / (100.0 + primarySexRatio);
double nrOfFemales = (100.0 * populationSize) / (primarySexRatio + 100.0);
long nrOfMalesLong = Math.round(nrOfMales);
long nrOfFemalesLong = Math.round(nrOfFemales);
// recalculate primarySexRatio
long primarySexRatioNew = Math.round((nrOfMales/nrOfFemales)*100.0);
The gender assignment of a population can be initialized based on the following demographic data: