import java.util.*; public class SearchDemo { public static void main(String[] args) { try{ List list = Arrays.asList(args); Collections.sort(list); System.out.println("The sorted list is: "+list); int pos = Collections.binarySearch(list, list.get(2)); System.out.println("The position of the searched element is : "+pos +" and the element is:"+list.get(2)); } catch(Exception e){} } }