public static int maxArea2(int[] height) {

```
int max=0;
int area=0;
for (int i =0; i< height.length; i++) {
for (int j = i + 1; j < height.length; j++) {
area = (j - i) * Math.min(height[i], height[j]);
if (max < area ) {
max = area;
}
}
}
return max;
}
```