In standard Java 11 library if element is not found, method should return:
...the index of the first element greater than the key...
on Java 11 this sample prints 17
int[] data = new int[] {2, 4, 5, 12, 17, 19};
System.out.println(data[-1 *Arrays.binarySearch(data, 6)]);
In this code sample, first element greater than 6 is 12, but it returns index of 17. Why?