import java.util.ArrayList; import java.util.Collections; public class BinarySearchExample { public static void main(String[] args) { ArrayListIn the above example, we have created an ArrayList of fruits and added some fruits to it. We then used the Collections.binarySearch() method to search for the element "cherry" in the list. The method returns the index of the element, which is 2 in this case. The Collections.binarySearch() method is located in the java.util.Collections package library.list = new ArrayList<>(); list.add("apple"); list.add("banana"); list.add("cherry"); list.add("date"); int index = Collections.binarySearch(list, "cherry"); System.out.println("Index of cherry is " + index); } }