The documentation says:
Returns
the index of the search key, if it is contained in the list;
otherwise, (-(insertion point) - 1). The insertion point is defined as
the point at which the key would be inserted into the list: the index
of the first element greater than the key, or list.size() if all
elements in the list are less than the specified key. Note that this
guarantees that the return value will be >= 0 if and only if the key
is found.
The important part is that last sentence:
Note that this guarantees that the return value will be >= 0 if and only if the key is found.
If effect, you're getting two values back from binarySearch, combined in a clever way. You get information about whether the item is present (by the sign of the result), and where it belongs (the magnitude of the result).