static LinkedHashMap<String, Double> getFixedProbabilityMap(final LinkedHashMap<String, Double> probabilityResultMap) {
        LinkedHashMap<String, Double> toReturn = new LinkedHashMap<>();
        String[] resultMapKeys = probabilityResultMap.keySet().toArray(new String[0]);
        AtomicReference<Double> sumCounter = new AtomicReference<>(0.0);
        for (int i = 0; i < probabilityResultMap.size(); i++) {
            String key = resultMapKeys[i];
            double value = probabilityResultMap.get(key);
            if (i < resultMapKeys.length - 1) {
                sumCounter.accumulateAndGet(value, Double::sum);
                toReturn.put(key, value);
            } else {
                // last element
                toReturn.put(key, 1 - sumCounter.get());
            }
        }
        return toReturn;
    }
@Test
    void getFixedProbabilityMap() {
        double initialTotalProbability = 0.99;
        AtomicReference<Double> totalReference = new AtomicReference<>(initialTotalProbability);
        Random rand = new Random();
        List<Double> doubles = IntStream.range(0, 3).mapToDouble(value -> {
            double remainingProbability = totalReference.get();
            double toReturn = invalidBound(remainingProbability) ? 0.00 :
                    Precision.round(rand.nextDouble(remainingProbability), 2);
            totalReference.set(Precision.round((remainingProbability - toReturn), 2));
            return toReturn;
        }).boxed().sorted((f1, f2) -> Double.compare(f2, f1)).toList();
        LinkedHashMap<String, Double> probabilityResultMap = new LinkedHashMap<>();
        int counter = 0;
        for (Double toPut : doubles) {
            probabilityResultMap.put("Element-" + counter, toPut);
            counter++;
        }
        double initialProbability = Precision.round(probabilityResultMap.values().stream().mapToDouble(x -> x).sum(),
                                                    2);
        assertThat(initialProbability).isLessThanOrEqualTo(initialTotalProbability);
        LinkedHashMap<String, Double> retrieved = PMMLRuntimeContextImpl.getFixedProbabilityMap(probabilityResultMap);
        double totalProbability = retrieved.values().stream().mapToDouble(x -> x).sum();
        assertThat(totalProbability).isCloseTo(1.0, Percentage.withPercentage(0.01));
    }