Here you can find the source of indexOf(int[] arr, int e)
public static int indexOf(int[] arr, int e)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static int indexOf(int[] arr, int e) { for (int i = 0; i < arr.length; i++) { if (arr[i] == e) { return i; }// w w w . ja v a 2s.co m } return -1; } public static int indexOf(String[] arr, String e) { for (int i = 0; i < arr.length; i++) { if (arr[i].equals(e)) { return i; } } return -1; } public static int indexOf(List<Integer> list, Integer value) { for (int i = 0; i < list.size(); i++) { if (list.get(i) == value) { return i; } } return -1; } }