Searching an Array
Let's discuss how we can use the binarySearch() method to search an element in an array.
We'll cover the following
Arrays is a class in the java.utils
package that contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be seen as a list. The methods in this class throw a NullPointerException
if the specified array reference is null
.
Get hands-on with 1400+ tech skills courses.