Short and easy JAVA solution !!
\npublic int numSubarrayBoundedMax(int[] nums, int left, int right) {\n        \n        int ans = 0;\n        \n        int s = -1;\n        int e = -1;\n     
```\npublic int numSubarrayBoundedMax(int[] nums, int left, int right) {\n        \n        int ans = 0;\n        \n        int s = -1;\n        int e = -1;\n        \n        for(int i = 0; i < nums.length; i++){\n\n            if(nums[i] >= left && nums[i] <= right){ // in range\n                e = i;\n            }else if(nums[i] > right){ // max\n                s = e = i;\n            }else{ // minimum\n                // do nothing\n            }\n            \n            ans += (e - s);\n        }\n        \n        return ans;\n    }\n```
['Java']