binarySearch(int[] a,int fromIndex,int toIndex, int key)的用法

package com.Summer_0420.cn;

import java.util.Arrays;

/**
 * @author Summer
 *  binarySearch(int[] a,int fromIndex,int toIndex, int key)的用法(测试)
 */
public class TestMethod05 {
    public static void main(String[] args) {
        int [] a = {1,2,3,4,5,6,7,8,9,10};
        int index = Arrays.binarySearch(a, 3, 9, 6);//(数组,起始索引,结束索引,搜索值)
        System.out.println(index);
    }
}

 

posted @ 2019-04-20 22:36  Geek张东坡  阅读(434)  评论(0编辑  收藏  举报