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); } }