Please see my code . I have matched the test cases ip and op are correct still i am not getting my ans

import java.util.*;
public class Main {
public static int print_last_index(int arr[] , int si , int M){
if(si == arr.length-1)
return -1 ;

	int index = print_last_index(arr , si+1 , M);
	if(index == -1){
		if(arr[si] == M){
		    return si ;
		}
		else {
			return -1 ;
		}
	}
	else{
        return index ;
	}

}
public static void main(String args[]) {
	int arr[] = {0 ,5 ,4 ,3, 88, 66, -67, 78};
	int ans = print_last_index(arr , 0 , 22);
	System.out.println(ans);

}

}

Hey @rahul1402 You have hardcoded the array you have to take input in an array from user then try to print ans according to that.