Finding an Element in a Sorted Array This example also works if the object is a primitive type. int index = Arrays.binarySearch( sortedArray, object); if (index < 0) { // not found }