import java.util.Arrays;
public class Main {
public static void main(String[] args) {
double doubleArray[] = { 1.3, 2.1, 4.7, 5.3 };
Arrays.sort(doubleArray);
double searchValue = 4.7;
System.out.println(Arrays.binarySearch(doubleArray, searchValue));
searchValue = 3.33;
System.out.println(Arrays.binarySearch(doubleArray, searchValue));
}
}
|