private int countBitsInMask(int i) {
        int count = 0;
        while (i != 0) {
            count += i & 1;
            // uses the unsigned version of java's right shift operator,
            // so that left hand bits are zeroed.
            i >>>= 1;
        }
        return count;
    }
A selection of tools for evaluating and manipulating color spaces, color values, etc.
<p>
The Javadoc provided in the original code gave the following notation:
</p>
<p>
TODO"This class is a mess and needs to be cleaned up."
</p>
src/main/java/org/apache/commons/imaging/ColorTools.java