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

        int rd = Math.abs( ((color1 & RED_MASK) >> 16) - ((color2 & RED_MASK) >> 16) );
        int gd = Math.abs( ((color1 & GREEN_MASK) >> 8) - ((color2 & GREEN_MASK) >> 8) );
        int bd = Math.abs( (color1 & BLUE_MASK) - (color2 & BLUE_MASK) );

        List<Integer> d = Arrays.asList(rd,gd,bd);
        int cheby = rd;
        for(int distance : d) {
            if(distance > cheby) cheby = distance;
        }

        return cheby;
    }