Java Array Search arraySearch(int[] arr, int i)

Here you can find the source of arraySearch(int[] arr, int i)

Description

array Search

License

Open Source License

Declaration

static int arraySearch(int[] arr, int i) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static int arraySearch(int[] arr, int i) {
        for (int j = 0; j < arr.length; j++) {
            if (arr[j] == i)
                return j;
        }/*from www.  ja va 2 s  .c om*/
        return -1;
    }

    static int arraySearch(Object[] arr, Object obj) {
        for (int j = 0; j < arr.length; j++) {
            if (arr[j].equals(obj))
                return j;
        }
        return -1;
    }
}

Related

  1. arraySearch(byte[] array, byte[] search)
  2. byteArraySearch(byte[] data, byte[] searchData)
  3. contains(byte[] array, byte toSearch)
  4. getFoundIdx(char to_find, char[] to_search, boolean do_orderAsc)
  5. indexOf(T[] array, T toSearch)