int getMedianValue() {
        long countTotal = 0;
        long alphaTotal = 0;
        long redTotal = 0;
        long greenTotal = 0;
        long blueTotal = 0;

        for (final ColorCount color : colorCounts) {
            countTotal += color.count;
            alphaTotal += color.count * color.alpha;
            redTotal += color.count * color.red;
            greenTotal += color.count * color.green;
            blueTotal += color.count * color.blue;
        }

        final int alpha = ignoreAlpha ? 0xff : (int) Math.round((double) alphaTotal / countTotal);
        final int red = (int) Math.round((double) redTotal / countTotal);
        final int green = (int) Math.round((double) greenTotal / countTotal);
        final int blue = (int) Math.round((double) blueTotal / countTotal);

        return alpha << 24 | red << 16 | green << 8 | blue;
    }
Gets a copy of the list of color counts.

@return a copy of the list of color counts
src/main/java/org/apache/commons/imaging/palette/ColorGroup.java