Question: I have N numbers in arraylist. To get the `indexOf`, arraylist will have to iterate maximum N times, so complexity is `O(N)`, is that correct?

Answer: 
Yes it's *O(n)* as it needs to iterate through every item in the list in the worst case.

The only way to achieve better than this is to have some sort of structure to the list. The most typical example being looking through a sorted list using binary search in *O(log n)* time.
100%, it needs to iterate through the list to find the correct index.