public float palDifUni(int[] a, int[] b)
    {
        boolean aTransp = a[3] == 0;
        boolean bTransp = b[3] == 0;

        if (aTransp != bTransp)
            return Float.POSITIVE_INFINITY;

        float dif = 0;
        int len = aTransp ? 3 : 4;

        boolean[] sel = new boolean[len];

        for (int i = 0; i < len; i++)
        {
            int c = a[i];
            float diff = Float.POSITIVE_INFINITY;
            int i2 = -1;
            for (int j = 0; j < len; j++)
            {
                if (sel[j])
                    continue;
                float diff2 = Util.colorDiff(c, b[j]);
                if (diff2 < diff || i2 == -1)
                {
                    i2 = j;
                    diff = diff2;
                }
            }
            sel[i2] = true;
            dif += diff;
        }

        return dif;
    }