it_worker365

   ::  ::  ::  ::  :: 管理

简单可得

/**
 * Created by itworker365 on 5/12/2017.
 */
public class RotateArray {
    public static void main(String[] args) {
        int[] array = {4,5,6,7,1,2,3};
        RotateArray rotateArray = new RotateArray();
        int min = rotateArray.minNumberInRotateArray(array);
        System.out.println(min);
    }
    public int minNumberInRotateArray(int [] array) {
        int min = array[0];
        for (int i = 1; i < array.length; i++) {
            if (array[i] < array[i - 1]) {
                min = array[i];
            }
        }
        return min;
    }
}

 

posted on 2017-05-12 16:32  it_worker365  阅读(130)  评论(0编辑  收藏  举报