```
public int findPeakElement(int [] num) {
int length = num.length, left = 0, right = length - 1;
while(true){
if(left==right) return left;
int mid = (left+right)/2;
if(num[mid] < num[mid+1]) left = mid+1;
else right = mid;
}
}
```