Android examples for java.lang:array
Check element index Of inside an array
import java.lang.reflect.Array; public class Main{ public static int indexOf(int[] list, int item) { for (int i = 0; i < list.length; i++) { if (list[i] == item) { return i; }/*from w w w . ja v a 2 s. com*/ } return -1; } public static int indexOf(Object[] list, Object item) { if (item == null) { return -1; } for (int i = 0; i < list.length; i++) { if (list[i].equals(item)) { return i; } } return -1; } }