public class Solution {
    public int FindGreatestSumOfSubArray(int[] array) {
        int len =array.length;
        int[] dp = new int[len];
        dp[0] =array[0];
        for(int i=1;i<len;i++){
            dp[i]=Math.max(array[i],array[i]+dp[i-1]);
        }
        int maxNum =Integer.MIN_VALUE;
        for(int j=0;j<len;j++){
            maxNum = maxNum>dp[j]?maxNum:dp[j];
        }
        return maxNum;
    }
}