guys, given the fact I have an array how can I find all occurrences of the number recursively. I have figure out how to do a linear search recursively, but that would exit once it finds the number... what modification do I need to make in order to find all occurrences of the number.

int[] nums = {20, 25, 29, 55, 25}
 
//search with recursion
    public static int search(int[] a, int n, int i)
    {
        if(i == a.length-1)
            return -1;
        else if(a[i] == n)
            return i;
        else
            return search(a, n, ++i);        
    }
 
search(nums, 25, 0);