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
.
Searching an element in an array
The Arrays
class provides the binarySearch()
method to search for a particular element in an array. There are a lot of overloaded ...