Here the java solution:
M[i] = max(A[i], M[i-1] + A[i])
void largestSumSubArray(int[] a){
if (a.length != 0){
int[] m = new int[a.length];
m[0] = a[0];
int maxIndex = m[0];
for (int i = 1; i maxIndex) maxIndex = i;
}
boolean found = false;
int i = maxIndex - 1;
while (!found){
if (m[i] > 0) i--;
}
System.out.printf("%d - %d", i, maxIndex);
}
}