I have taken an int[] as input. For searching the index of an integer in the array I used Arrays.asList(arr).indexOf(element)
method. However, I am getting index as -1
even if the element is present in the array.
Asked
Active
Viewed 581 times
3

Suresh Atta
- 120,458
- 37
- 198
- 307

sigma99
- 31
- 3
-
1Post the code and sample data for which you get this output. – Sanket Makani Jun 14 '17 at 09:52
1 Answers
2
int[] is one object, so Arrays.asList(arr) puts one object in the list, you need to put values from int[] one by one

Evgeniy Dorofeev
- 133,369
- 30
- 199
- 275