presto-main/src/main/java/io/prestosql/operator/aggregation/NumericHistogram.java/NumericHistogram/sort
class NumericHistogram:    private static void sort(final double[] values, final double[] weights, int nextIndex)
    {
        // sort x and y value arrays based on the x values
        Arrays.quickSort(0, nextIndex, new AbstractIntComparator()
        {
            @Override
            public int compare(int a, int b)
            {
                return Doubles.compare(values[a], values[b]);
            }
        }, new Swapper()
        {
            @Override
            public void swap(int a, int b)
            {
                double temp = values[a];
                values[a] = values[b];
                values[b] = temp;

                temp = weights[a];
                weights[a] = weights[b];
                weights[b] = temp;
            }
        });
    }