Driver code to test above methods
public static void main ( String [ ] args ) { int arr [ ] = { 3 , 4 , 3 , 5 , 2 , 3 , 4 , 3 , 1 , 5 } ; int n = arr . length ; int idxOfEle = 5 ; System . out . println ( getIndexInSortedArray ( arr , n , idxOfEle ) ) ; } }