```
public class Solution {
public int maxArea(int[] height) {
int maxarea=0;
int temparea=0;
int m=0,n=height.length-1;
while(m!=n){
if(height[m]<height[n]){
temparea=height[m]*(n-m);
m++;
}
else{
temparea=height[n]*(n-m);
n--;
}
if(maxarea<temparea) maxarea=temparea;
}
return maxarea;
}
```

}