New in Java. I know it will be more effective to use DP method. Just wanna get some suggestion or recommend from what I did. Thank you.

This is my Java solution and have no idea if it is really works, though get the correct answer from the given array.

```
class Solution {
public int maxSubArray(int[] nums) {
int n = nums.length;
int max = nums[0];
for(int j = 0;j < n;j++) {
for (int i = 0;i<n-j; i++) {
int sum = 0;
for(int z = 0;z<j+1;z++) {
sum = sum + nums[i+z];
if(sum > max) {
max = sum;
}
}
}
}
return max;
}
}
```