Code with Finding: |
class ArrayUtils {
/**
* <p>Finds the index of the given value in the array.</p>
*
* <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p>
*
* @param array the array to search through for the object, may be <code>null</code>
* @param valueToFind the value to find
* @return the index of the value within the array,
* {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input
*/
public static int indexOf(int[] array, int valueToFind) {
return indexOf(array, valueToFind, 0);
}
}
|