```
public int maxArea(int[] height) {
if(height.length <= 0 || height == null) return 0;
int area = 0;
int left = 0;
int right = height.length - 1;
while(left < right) {
int minHeight = Math.min(height[left], height[right]);
area = Math.max(area,((right - left) * minHeight));
if(height[left] <= height[right]) left++;
else right--;
}
return area;
}
```