public class Solution {
public int FindGreatestSumOfSubArray(int[] array) {
int thisSum=0, maxSum=array[0];
for(int i=0;i<array.length;i++){
thisSum+=array[i];
if(thisSum>maxSum){
maxSum=thisSum;
}else if(thisSum<0){
thisSum = 0;
}
}
return maxSum;
}
}