```
public int findMin(int[] nums) {
int l = 0, r = nums.length-1;
while (l < r) {
int mid = (l + r) / 2;
if (nums[mid] < nums[r]) {
//right side in order, and mid is smallest of right side,
// min should be mid or in left.
r = mid;
} else {
//left side in order and it is the larger part,
// min should be in right side.
l = mid + 1;
}
}
return nums[l];
}
```