if the array is indeed rotated by some pivot, there are only 2 possibilities

- a[mid] > a[left] && a[mid] > a[right], meaning we are on the bigger part, the smaller part is on our right, so go right

- a[mid] < a[left] && a[mid] < a[right], meaning we are on the smaller part, to find the smallest element, go left

if the array is not rotated (actually one rotating cycle completed), we just need to go left, in this case a[mid] < a[right] always holds.

combining the cases above, we conclude that

if a[mid] > a[right], go right; if a[mid] < a[right], go left.

```
public class Solution {
public int findMin(int[] nums) {
if (nums==null || nums.length==0) { return Integer.MIN_VALUE; }
int left = 0, right = nums.length-1;
while (left < right-1) { // while (left < right-1) is a useful technique
int mid = left + (right-left)/2;
if (nums[mid] > nums[right]) { left = mid; }
else { right = mid; }
}
if (nums[left] > nums[right]) { return nums[right]; }
return nums[left];
}
}
```