Android Utililty Methods Array Index Of

List of utility methods to do Array Index Of

Description

The list of methods to do Array Index Of are organized into topic(s).

Method

intindexOf(double[] array, double valueToFind)

Finds the index of the given value in the array.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

return indexOf(array, valueToFind, 0);
intindexOf(double[] array, double valueToFind, double tolerance)

Finds the index of the given value within a given tolerance in the array.

return indexOf(array, valueToFind, 0, tolerance);
intindexOf(double[] array, double valueToFind, int startIndex)

Finds the index of the given value in the array starting at the given index.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex is treated as zero.

if (ArrayUtils.isEmpty(array)) {
    return INDEX_NOT_FOUND;
if (startIndex < 0) {
    startIndex = 0;
for (int i = startIndex; i < array.length; i++) {
    if (valueToFind == array[i]) {
...
intindexOf(double[] array, double valueToFind, int startIndex, double tolerance)

Finds the index of the given value in the array starting at the given index.

if (ArrayUtils.isEmpty(array)) {
    return INDEX_NOT_FOUND;
if (startIndex < 0) {
    startIndex = 0;
double min = valueToFind - tolerance;
double max = valueToFind + tolerance;
...
intindexOf(float[] array, float valueToFind)

Finds the index of the given value in the array.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

return indexOf(array, valueToFind, 0);
intindexOf(float[] array, float valueToFind, int startIndex)

Finds the index of the given value in the array starting at the given index.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex is treated as zero.

if (ArrayUtils.isEmpty(array)) {
    return INDEX_NOT_FOUND;
if (startIndex < 0) {
    startIndex = 0;
for (int i = startIndex; i < array.length; i++) {
    if (valueToFind == array[i]) {
...
intindexOf(int n, int[] array)
index Of
for (int i = 0; i != array.length; ++i) {
    if (array[i] == n)
        return i;
return -1;
intindexOf(int[] array, int valueToFind)

Finds the index of the given value in the array.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

return indexOf(array, valueToFind, 0);
intindexOf(int[] array, int valueToFind, int startIndex)

Finds the index of the given value in the array starting at the given index.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex is treated as zero.

if (array == null) {
    return INDEX_NOT_FOUND;
if (startIndex < 0) {
    startIndex = 0;
for (int i = startIndex; i < array.length; i++) {
    if (valueToFind == array[i]) {
...
intindexOf(long[] array, long valueToFind)

Finds the index of the given value in the array.

This method returns #INDEX_NOT_FOUND (-1) for a null input array.

return indexOf(array, valueToFind, 0);