class SimpleBinaryRepresentation implements GenotypeRepresentation {

    protected double[] binaryToInteger(){
        double[] intValues = new double[this.descriptor.getNumVariables()];
        boolean[] decodedGenome = this.decodeGenomeToBinary();
        int index = MathUtils.sumSizes(this.descriptor.variablesLengths) - 1; // start from the end
        double intValue;
        double power; // stores power of two
        // for every variable...
        for (int variable = intValues.length - 1; variable >= 0 ; variable--){
            intValue = 0.0;
            power = 1.0;
            // ... extract its value
            for (int gene = 0; gene < this.descriptor.getVariablesLengths()[variable]; gene++){
                intValue += (decodedGenome[index--]?power:0);
                power *= 2;
            }
            intValues[variable] = Math.ceil(intValue); // make it round int value due to accumulated error
        }
        return intValues;
    }

    public  SimpleBinaryRepresentation(SimpleBinaryGenomeDescriptor descriptor);
    public  SimpleBinaryRepresentation(SimpleBinaryRepresentation second);

}