```
public class Solution {
public ArrayList<Integer> maxset(int[] a) {
int current_sum = a[0];
int global_sum = a[0];
for (int i = 1; i < a.length; i++) {
current_sum = Math.max(a[i], a[i]+current_sum);
if (current_sum > global_sum) {
global_sum = current_sum;
}
}
return global_sum;
}
}
```