<awangdev>Maximum Subarray II_5.java
public int maxTwoSubArrays(ArrayList<Integer> nums) {
        if (nums == null || nums.size() == 0) {
            return 0;
        }
        int[] frontSum = new int[nums.size()];
        int[] endSum = new int[nums.size()];
        int maxSum = 0;
        frontSum[0] = nums.get(0);
        for (int i = 1; i < frontSum.length; i++) {
            if (frontSum[i - 1] < 0) {
                frontSum[i] = nums.get(i);
            } else {
                frontSum[i] = frontSum[i - 1] + nums.get(i);
            }
        }
        maxSum = frontSum[0];
        for (int i = 1; i < frontSum.length; i++) {
            if (frontSum[i] < maxSum) {
                frontSum[i] = maxSum;
            } else {
                maxSum = frontSum[i];
            }
        }
        
        endSum[endSum.length - 1] = nums.get(nums.size() - 1);
        for (int i = endSum.length - 2; i >= 0; i--) {
            if (endSum[i + 1] < 0) {
                endSum[i] = nums.get(i);
            } else {
                endSum[i] = endSum[i + 1] + nums.get(i);
            }
        }
        maxSum = endSum[endSum.length - 1];
        for (int i = endSum.length - 2; i >= 0; i--) {
            if (endSum[i] < maxSum) {
                endSum[i] = maxSum;
            } else {
                maxSum = endSum[i];
            }
        }
        maxSum = Integer.MIN_VALUE;
        for (int i = 0; i < nums.size() - 1; i++) {
            maxSum = Math.max(maxSum, frontSum[i] + endSum[i + 1]);
        }
        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 ( ) ] ;
  int [ ] var_7 = new int [ var_2 . size ( ) ] ;
  int var_8 = 0 ;
  var_6 [ 0 ] = var_2 . get ( 0 ) ;
  for ( int var_11 = 1 ;
  var_11 < var_6 . length ;
  var_11 ++ ) {
    if ( var_6 [ var_11 - 1 ] < 0 ) {
      var_6 [ var_11 ] = var_2 . get ( var_11 ) ;
    }
    else {
      var_6 [ var_11 ] = var_6 [ var_11 - 1 ] + var_2 . get ( var_11 ) ;
    }
  }
  var_8 = var_6 [ 0 ] ;
  for ( int var_11 = 1 ;
  var_11 < var_6 . length ;
  var_11 ++ ) {
    if ( var_6 [ var_11 ] < var_8 ) {
      var_6 [ var_11 ] = var_8 ;
    }
    else {
      var_8 = var_6 [ var_11 ] ;
    }
  }
  var_7 [ var_7 . length - 1 ] = var_2 . get ( var_2 . size ( ) - 1 ) ;
  for ( int var_11 = var_7 . length - 2 ;
  var_11 >= 0 ;
  var_11 -- ) {
    if ( var_7 [ var_11 + 1 ] < 0 ) {
      var_7 [ var_11 ] = var_2 . get ( var_11 ) ;
    }
    else {
      var_7 [ var_11 ] = var_7 [ var_11 + 1 ] + var_2 . get ( var_11 ) ;
    }
  }
  var_8 = var_7 [ var_7 . length - 1 ] ;
  for ( int var_11 = var_7 . length - 2 ;
  var_11 >= 0 ;
  var_11 -- ) {
    if ( var_7 [ var_11 ] < var_8 ) {
      var_7 [ var_11 ] = var_8 ;
    }
    else {
      var_8 = var_7 [ var_11 ] ;
    }
  }
  var_8 = Integer . MIN_VALUE ;
  for ( int var_11 = 0 ;
  var_11 < var_2 . size ( ) - 1 ;
  var_11 ++ ) {
    var_8 = Math . max ( var_8 , var_6 [ var_11 ] + var_7 [ var_11 + 1 ] ) ;
  }
  return var_8 ;
}
