import java.util.Arrays; public class Main { public static void main(String[] argv) throws Exception { // Create an array with an ordered list of numbers int[] sortedIntArray = new int[] { 1, 2, 3, 5, 7 }; // Search for 6 int index = Arrays.binarySearch(sortedIntArray, 6); System.out.println(index); } }