text: Driver code
code: public static void main ( String [ ] args ) { int arr [ ] = { 3 , 3 , 1 , 2 , 3 , 3 } ; int n = arr . length ; int key = 3 ; System . out . println ( search ( arr , 0 , n - 1 , key ) ) ; } }