SimpleBinaryRepresentation implements GenotypeRepresentation { public void setDoubleValue(double[] phenotypeValue) { if (this.genome == null || this.genome.length == 0){ this.genome = new boolean[MathUtils.sumSizes(this.descriptor.getVariablesLengths())]; } double[] intValues = new double[this.descriptor.getNumVariables()]; for (int i = 0; i < this.descriptor.getNumVariables(); i++){ if (phenotypeValue[i] < this.descriptor.getVariablesLowerBounds()[i]){ phenotypeValue[i] = this.descriptor.getVariablesLowerBounds()[i]; } intValues[i] = Math.ceil((phenotypeValue[i] - this.descriptor.getVariablesLowerBounds()[i]) / this.descriptor.getVariablesPrecisions()[i]); } integerToBinary(intValues); } SimpleBinaryRepresentation(SimpleBinaryGenomeDescriptor descriptor);  SimpleBinaryRepresentation(SimpleBinaryRepresentation second); int getTotalLength(); int[] getValueLengths(); boolean getGeneAt(int idx); void setGeneAt(int idx, boolean value); void invertGeneAt(int idx); void swapGenes(GenotypeRepresentation secondRepresentation, int[] positions); void swapGenes(GenotypeRepresentation secondRepresentation, int from, int to); void receiveGenes(GenotypeRepresentation secondRepresentation, int[] positions); void receiveGenes(GenotypeRepresentation secondRepresentation, int from, int to); void andGenes(GenotypeRepresentation secondRepresentation, int[] positions); void andGenes(GenotypeRepresentation secondRepresentation, int from, int to); void orGenes(GenotypeRepresentation secondRepresentation, int[] positions); void orGenes(GenotypeRepresentation secondRepresentation, int from, int to); void xorGenes(GenotypeRepresentation secondRepresentation, int[] positions); void xorGenes(GenotypeRepresentation secondRepresentation, int from, int to); double[] getDoubleValue(); void setDoubleValue(double[] phenotypeValue); Representation copy();  }
@Test public void testSetDoubleValue1(){ this.representation.setDoubleValue(new double[]{13.0, 1.0, 1851.75+10e10, 123456.5}); boolean[] genome = this.representation.genome; boolean[] expected = new boolean[]{ false, true, false, true, true, true, true, false, true, true, true, true, true, true, true, true, true, false, true, false, false }; assertEquals(expected.length, genome.length); for (int i = 0; i < expected.length; i++){ assertEquals(expected[i], genome[i]); } }