public static int maxSubArray(int[] a){
        if (a == null || a.length <0)return 0;
        int sum = 0;
        int max = 0;
        int num = 0;
        for (int i = 0; i < a.length; i++){
            sum += a[i];
            //如果sum小于0，则将其置为0，否则负值与后边的数相加会肯定会使总的和变小
            if (sum < 0) sum = 0;
            if (sum > max) max = sum;
            num++;
        }
            System.out.println(num);
            if (max == 0){
                int maxNum = a[0];
                for (int j : a){
                    if (j > maxNum){
                        maxNum = j;
                    }
                }
                return maxNum;
            }
            return max;
    }