<awangdev>53. Maximum Subarray_9.java
public int maxSubArray(ArrayList<Integer> nums) {
        if (nums == null || nums.size() == 0) {
            return 0;
        }
        int[] sums = new int[nums.size()];
        sums[0] = nums.get(0);
        int maxSum = sums[0];
        for (int i = 1; i < sums.length; i++) {
            if (sums[i - 1] < 0) {
                sums[i] = nums.get(i);
            } else {
                sums[i] = sums[i - 1] + nums.get(i);
            }
             maxSum = Math.max(maxSum, sums[i]);
        }
        return maxSum;
    }
public int sample_funcname ( ArrayList < Integer > var_2 ) {
  if ( var_2 == null || var_2 . size ( ) == 0 ) {
    return 0 ;
  }
  int [ ] var_6 = new int [ var_2 . size ( ) ] ;
  var_6 [ 0 ] = var_2 . get ( 0 ) ;
  int var_8 = var_6 [ 0 ] ;
  for ( int var_10 = 1 ;
  var_10 < var_6 . length ;
  var_10 ++ ) {
    if ( var_6 [ var_10 - 1 ] < 0 ) {
      var_6 [ var_10 ] = var_2 . get ( var_10 ) ;
    }
    else {
      var_6 [ var_10 ] = var_6 [ var_10 - 1 ] + var_2 . get ( var_10 ) ;
    }
    var_8 = Math . max ( var_8 , var_6 [ var_10 ] ) ;
  }
  return var_8 ;
}
