int rgb2 = colorMap[idx];
int rgb2 = colorMap[i];
    int findIndex(int r1, int g1, int b1, int a1)        throws ArrayIndexOutOfBoundsException {        int idx = 0;        long dist = Long.MAX_VALUE;        for (int i = 0; i < colorMap.length; i++) {            int rgb2 = colorMap[idx];            int a2 = (rgb2 >> 24) & 0xff;            int r2 = (rgb2 >> 16) & 0xff;            int g2 = (rgb2 >> 8) & 0xff;            int b2 = rgb2 & 0xff;            int da = a1 - a2;            int dr = r1 - r2;            int dg = g1 - g2;            int db = b1 - b2;            long newdist = da * da + dr * dr + dg * dg + db * db;            if (newdist < dist) {                idx = i;                dist = newdist;            }        }        return idx;    }