# Example of a binary search program in Java

I continue to fill the section for novice Java programmers with useful articles. This time we will look at an example of a binary search program in Java. It is known that Java has a standard class in which different variations of binary search are already implemented, but in this article we will write our implementation of this algorithm in Java.`java.util.Arrays`

`binarySearch()`

### Briefly about binary search

Binary or binary search is one of the classic algorithms for finding items in

a sortedlist or array of numbers. The search occurs by dividing the elements of the array into halves.

Below is a program that implements the binary search algorithm. The size and elements of the array will be entered by the user.

The result of the binary (binary) search program in Java:

The result of a failed binary search:

Here is such a simple program to demonstrate how binary search works in Java. Stay tuned in the Getting Started section and read more Java articles for beginners.