public static int kullbackDist(int color1, int color2) {

        int red1 = (color1 & RED_MASK) >> 16; 
        int green1 = (color1 & GREEN_MASK) >> 8;
        int blue1 = (color1 & BLUE_MASK);
        int red2 = (color2 & RED_MASK) >> 16; 
        int green2 = (color2 & GREEN_MASK) >> 8;
        int blue2 = (color2 & BLUE_MASK);

        int sp = red1 + green1 + blue1;
        int sq = red2 + green2 + blue2;
        List<Integer> p = Arrays.asList(red1,green1,blue1);
        List<Integer> q = Arrays.asList(red2,green2,blue2);

        double ln = 0;
        for(int i =0; i < 3; i++) {
            ln = p.get(i)*Math.log((double)p.get(i)/(double)q.get(i));
        }

        return (int)(ln - sp + sq);

    }