Search for a specified value of an array
import java.util.Arrays; public class Main { public static void main(String[] args) { int items[] = { 5, 4, 6, 1, 8, 9, 6, 7, 3, 2 }; Arrays.sort(items); int index = Arrays.binarySearch(items, 1); System.out.println("Search item found at: " + index); } }