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 could convert it to a list, then use the indexOf method:
Array.asList(array).indexOf(1);
http://download.oracle.com/javase/1.5.0/docs/api/java/util/Arrays.html#asList(T...) http://download.oracle.com/javase/1.5.0/docs/api/java/util/List.html#indexOf(java.lang.Object)