```
int start = 0, end = nums.length-1, mid = start;
if (end == -1) {
return -1;
}
while (start < end){
mid = start + (end-start)/2;
// The middle value is larger than end, means the smaller value belongs to the latter part, exclude the middle value
if (nums[mid] > nums[end]) {
start = mid+1;
}
// Otherwise, the smaller value belongs to the former part, including the middle value
else {
end = mid;
}
}
return nums[start];
}
```