```
public int findPeakElement(int[] nums) {
int l = 0, h = nums.length;
while (l < h) {
int m = l + (h - l) / 2;
if (nums[m] < (m+1 < nums.length ? nums[m+1] : Integer.MIN_VALUE ))
l = m + 1;
else if (nums[m] < (m-1 >= 0 ? nums[m-1] : Integer.MIN_VALUE))
h = m;
else return m;
}
return h;
}
```