public class _Test_31_1{
public int FindGreatestSumOfSubArray(int[] array) {
int max = array[0],tempMax = array[0];
for(int i = 1, len = array.length; i < len; ++i) {
tempMax = tempMax < 0 ? array[i] : tempMax + array[i];
max = max > tempMax ? max : tempMax;
}
return max;
}
}