### Question:
ProbabilitiesConvertor { public static float[] convertProbabilitiesToDosage(float[][] probs, double minProbability) { float[] dosages = new float[probs.length]; for (int i = 0; i < probs.length; ++i) { boolean containsMinProbability = false; for (float prob : probs[i]) { if (prob >= minProbability) { containsMinProbability = true; break; } } if (containsMinProbability) { dosages[i] = (probs[i][0] * 2) + probs[i][1]; if (dosages[i] > 2) { dosages[i] = 2; } } else { dosages[i] = -1; } } return dosages; }  static float[][] convertCalledAllelesToProbability(List<Alleles> sampleAlleles, Alleles alleles); static float[][] convertDosageToProbabilityHeuristic(float[] sampleDosages); static List<Alleles> convertProbabilitiesToAlleles(float[][] probs, Alleles variantAlleles, double minProbability); static float[] convertProbabilitiesToDosage(float[][] probs, double minProbability); static float[][] convertBiallelicComplexProbabilitiesToProbabilities(double[][] complexProbabilities); static double[][] convertProbabilitiesToComplexProbabilities(float[][] probabilities); static double[][] convertPhasedProbabilitiesToComplexProbabilities(double[][][] haplotypeProbabilities); static double[][][] haplotypeDosagesToHaplotypeProbabilities(double[][] haplotypeDosages); static double[][][] convertCalledAllelesToPhasedProbabilities(List<Alleles> sampleAlleles, Alleles alleles); static double[][] convertCalledAllelesToComplexProbabilities(
    		List<Alleles> allelesPerSample, Alleles variantAlleles);  }### Answer:
@Test public void testConvertProbabilitiesToDosage() { System.out.println("convertProbabilitiesToAlleles"); float[][] probs = new float[8][3]; probs[0] = new float[]{1, 0, 0}; probs[1] = new float[]{1, 0, 0}; probs[2] = new float[]{0, 1, 0}; probs[3] = new float[]{0, 1, 0}; probs[4] = new float[]{0, 0, 1}; probs[5] = new float[]{0, 1, 0}; probs[6] = new float[]{0.3f, 0.3f, 0.3f}; probs[7] = new float[]{0.3f, 0.3f, 0.4f}; float[] expectedDosage = new float[]{2,2,1,1,0,1,-1,0.9f}; float[] dosage = ProbabilitiesConvertor.convertProbabilitiesToDosage(probs, 0.4); assertEquals(dosage, expectedDosage, 0.00001f, ""); }