public static <T> void bubble(T[] a, Comparator<T> c)
    {
        if (a == null || a.length <= 1)
        {
            return;
        }
        int n = a.length;
        while (n > 0)
        {
            int j = 0;
            for (int i = 1; i < n; ++i)
            {
                if (c.compare(a[i - 1], a[i]) > 0)
                {
                    swap(a, i - 1, i);
                    j = i;
                }
            }
            n = j;
        }
    }