if (i < 0)
sumNeg += A[i];

This is unnecessary and will never will be executed inside the for loop.