public static int euclideanDistance(int color1, int color2)
    {
        int dRed = ((color1 & RED_MASK) >> 16) - ((color2 & RED_MASK) >> 16);
        int dGreen = ((color1 & GREEN_MASK) >> 8) - ((color2 & GREEN_MASK) >> 8);
        int dBlue = (color1 & BLUE_MASK) - (color2 & BLUE_MASK);

        int dist = dRed*dRed + dGreen*dGreen + dBlue*dBlue;

        return dist;
    }