Java Arrays 二分查找 Short 索引 Java Arrays 二分查找 对象 索引 Java Arrays 二分查找 Short Java Arrays 二分查找 Short 索引 package com.codingdict; import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { // initializing unsorted short array short shortArr[] = {5,2,15,52,10}; // sorting array Arrays.sort(shortArr); // let us print all the elements available in list System.out.println("The sorted short array is:"); for (short number : shortArr) { System.out.println("Number = " + number); } // entering the value to be searched short searchVal = 15; // entering range of index int retVal = Arrays.binarySearch(shortArr,3,4,searchVal); System.out.println("The index of element 15 is : " + retVal); } } Java Arrays 二分查找 对象 索引 Java Arrays 二分查找 Short