first index of a number using recursion java