You can use modern Java to solve this problem. Please use the code below:
static int findIndexOf(int V, int[] arr) {
return IntStream.range(0, arr.length)
.filter(i->arr[i]==V)
.findFirst()
.getAsInt();
}