```
int i = 0;
int j = height.length - 1;
int max = Integer.MIN_VALUE;
while (i < j)
{
int temp = Math.min(height[j] , height[i])*(j-i);
if (max < temp)
max = temp;
if (height[j] < height[i])
j--;
else
i++;
}
return max;
```