# Binary Search - Java

A Binary Search is a searching algorithm used to search a collection or array.

## What is a **Binary Search**?

A **Binary Search** is a searching algorithm used 
to search a collection or array. It is often more efficient
than a full scan of the collection.

The collection must be sorted to perform a binary search.

A binary search returns the index of the position 
where the item was found. (Or it returns the negative inverse 
of the position where the item should be inserted if it
is not found).

```java
int index = Arrays.binarySearch(names, "Francis");
```

Level: Freelancer · [More Java terms at this level](https://www.ask-codey.com/glossary/subjects/java/freelancer)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/binary-search-java
