Simple java solution with comments
\npublic int getMaxLen(int[] nums) {\n        //hold currMin and currMax length\n        int currMin = 0;\n        int currMax = 0;\n\t\t//hold answer\n        
```\npublic int getMaxLen(int[] nums) {\n        //hold currMin and currMax length\n        int currMin = 0;\n        int currMax = 0;\n\t\t//hold answer\n        int globMax = 0;\n        for(int i=0;i<nums.length;i++) {\n\t\t    //if current element is 0, restart curr max and min length\n            if(nums[i]==0) {\n                currMax=0;\n                currMin=0;\n            } else {\n\t\t\t    //if currMin length is zero. don\'t increment\n                if(currMin>0) {\n                    currMin++;\n                }\n                currMax++;\n                //if negative number found just reverse the currMin and currMax\n\t\t\t\tif(nums[i]<0) {\n                    int t = currMax;\n                    currMax = currMin;\n                    currMin = t;\n                }\n\t\t\t\t//max of both currMax and globMax\n                globMax=Math.max(globMax,currMax);\n            }             \n            \n        }\n        return globMax;\n    }\n```
['Greedy', 'Java']