Is the below code fine ?
public static int LastIndex1(int[] arr, int si, int data) {
int idx = -1, x = -1;
if (si != arr.length) {
if (arr[si] == data) {
idx = si;
}
x = LastIndex1(arr, si + 1, data);
if (x > idx) {
return x;
} else {
return idx;
}
} else {
return -1;
}
}