Code review comment: `totalCount` has been removed from accumulator in the latest commit, and will be calculated in `getValue()` once needed.

Code under review:
public Double[] getValue() {
            
            
            List<Pair<Double, Integer>> sortedPercentages = new ArrayList<>();
            for (int index = 0; index < percentages.length; index++) {
                sortedPercentages.add(new Pair<>(percentages[index] * (totalCount - 1) + 1, index));
            }
            sortedPercentages.sort(Comparator.comparing(Pair::getKey));

            
            List<Map.Entry<Double, Long>> sortedList = new ArrayList<>();
            try {
                for (Map.Entry<Double, Long> entry : valueCount.entries()) {
                    sortedList.add(entry);
                }
            } catch (Exception e) {
                throw new FlinkRuntimeException(e);
            }
            sortedList.sort(Map.Entry.comparingByKey());

            Double[] percentiles = new Double[percentages.length];

            long preCnt = sortedList.get(0).getValue();
            for (int i = 0, j = 0; i < sortedPercentages.size(); i++) {
                Pair<Double, Integer> entry = sortedPercentages.get(i);
                double position = entry.getKey();
                long lower = (long) Math.floor(position);
                long higher = (long) Math.ceil(position);

                
                
                while (preCnt < lower) {
                    j++;
                    preCnt += sortedList.get(j).getValue();
                }

                percentiles[entry.getValue()] =
                        preCnt >= higher
                                
                                
                                ? sortedList.get(j).getKey()
                                
                                : (higher - position) * sortedList.get(j).getKey()
                                        + (position - lower) * sortedList.get(j + 1).getKey();
            }

            return percentiles;
        }


Revised code:
public Double[] getValue() {
            
            
            
            long totalCount = 0L;

            
            List<Map.Entry<Double, Long>> sortedList = new ArrayList<>();
            try {
                for (Map.Entry<Double, Long> entry : valueCount.entries()) {
                    sortedList.add(entry);
                    totalCount += entry.getValue();
                }
            } catch (Exception e) {
                throw new FlinkRuntimeException(e);
            }

            if (totalCount <= 0) {
                return null;
            }

            sortedList.sort(Map.Entry.comparingByKey());

            
            
            List<Pair<Double, Integer>> sortedPercentages = new ArrayList<>();
            for (int index = 0; index < percentages.length; index++) {
                sortedPercentages.add(new Pair<>(percentages[index] * (totalCount - 1) + 1, index));
            }
            sortedPercentages.sort(Comparator.comparing(Pair::getKey));

            Double[] percentiles = new Double[percentages.length];

            long preCnt = sortedList.get(0).getValue();
            for (int i = 0, j = 0; i < sortedPercentages.size(); i++) {
                Pair<Double, Integer> entry = sortedPercentages.get(i);
                double position = entry.getKey();
                long lower = (long) Math.floor(position);
                long higher = (long) Math.ceil(position);

                
                
                while (preCnt < lower) {
                    j++;
                    preCnt += sortedList.get(j).getValue();
                }

                percentiles[entry.getValue()] =
                        preCnt >= higher
                                
                                
                                ? sortedList.get(j).getKey()
                                
                                : (higher - position) * sortedList.get(j).getKey()
                                        + (position - lower) * sortedList.get(j + 1).getKey();
            }

            return percentiles;
        }