public void sortColors(int[] A) {
       int count0 = 0, count1 = 0, count2 = 0;

        if(A == null || A.length == 0)
        {
            return;
        }

        for(int i=0; i<A.length; i++)
        {
            count0 += A[i]==0?1:0;
            count1 += A[i]==1?1:0;
            count2 += A[i]==2?1:0;
        }
        for(int i=0; i<count0; i++)
        {
            A[i] = 0;
        }
        for(int i=0;i<count1; i++)
        {
            A[i+count0] = 1;
        }
        for(int i=0;i<count2; i++)
        {
            A[i+count0+count1] = 2;
        }
    }