MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / main

Method main

Programs/BinarySearch.java:28–45  ·  view source on GitHub ↗
(String args[])

Source from the content-addressed store, hash-verified

26
27 // Driver method to test above
28 public static void main(String args[])
29 {
30 BinarySearch ob = new BinarySearch();
31 Scanner kb = new Scanner(System.in);
32 int n = kb.nextInt();
33 int arr[] = new int[n];
34 for(int i=0;i<n;i++){
35 arr[i]=kb.nextInt();
36 }
37 int length = arr.length;
38 int target = 10;
39 int result = ob.binarySearch(arr, 0, length - 1, target);
40 if (result == -1)
41 System.out.println("Element not present");
42 else
43 System.out.println("Element found at index " + result);
44 kb.close();
45 }
46}

Callers

nothing calls this directly

Calls 1

binarySearchMethod · 0.95

Tested by

no test coverage detected