Java Arrays 二分查找Double索引 Java Arrays 二分查找 Java Arrays 二分查找 Float Java Arrays 二分查找Double索引 package com.codingdict; import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { // initializing unsorted double array double doubleArr[] = {5.4,4.6,49.2,9.2,35.4}; // sorting array Arrays.sort(doubleArr); // let us print all the elements available in list System.out.println("The sorted double array is:"); for (double number : doubleArr) { System.out.println("Number = " + number); } // entering the value to be searched double searchVal = 5.4; // entering the range of index int retVal = Arrays.binarySearch(doubleArr,1,3,searchVal); System.out.println("The index of element 5.4 is : " + retVal); } } Java Arrays 二分查找 Java Arrays 二分查找 Float