Code: Select all
// binary search on real exam
var array = List.of(1,3,2);
int i = Collections.binarySearch(array,3);
System.out.println(i);
However, the correct answer is '1' as binary search starts at the middle of the array where the correct value happens to be.