How can I find an index of a certain value in a Java array of type int?
int
I tried using Arrays.binarySearch on my unsorted array, it only som
Arrays.binarySearch
You can use modern Java to solve this problem. Please use the code below:
static int findIndexOf(int V, int[] arr) { return IntStream.range(1, arr.length).filter(i->arr[i]==V).findFirst().getAsInt(); }