finds the element of a
vector that has the largest absolute value.

@param arr
@return
509324
@Override
    public int iamax(INDArray arr) {
        if (arr.isSparse()) {
            return Nd4j.getSparseBlasWrapper().level1().iamax(arr);
        }
        if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
            OpProfiler.getInstance().processBlasCall(false, arr);

        if (arr.data().dataType() == DataType.DOUBLE) {
            DefaultOpExecutioner.validateDataType(DataType.DOUBLE, arr);
            return idamax(arr.length(), arr, BlasBufferUtil.getBlasStride(arr));
        } else {
            DefaultOpExecutioner.validateDataType(DataType.FLOAT, arr);
            return isamax(arr.length(), arr, BlasBufferUtil.getBlasStride(arr));
        }
    }
1128967
public static Vector toVector(INDArray arr) {
        if (!arr.isVector()) {
            throw new IllegalArgumentException("passed in array must be a vector");
        }
        // FIXME: int cast
        double[] ret = new double[(int) arr.length()];
        for (int i = 0; i < arr.length(); i++) {
            ret[i] = arr.getDouble(i);
        }

        return Vectors.dense(ret);
    }
463284
public static <T extends Comparable<? super T>>  int[] sort(T[] arr) {
        int[] order = new int[arr.length];
        for (int i = 0; i < order.length; i++) {
            order[i] = i;
        }
        sort(arr, order);
        return order;
    }
640777
public static int max(int[] x) {
        int m = x[0];

        for (int n : x) {
            if (n > m) {
                m = n;
            }
        }

        return m;
    }
1356992
public static long searchMax(long[] longArray) {
        if(longArray.length == 0) {
            throw new IllegalArgumentException("The array you provided does not have any elements");
        }

        long max = longArray[0];

        for(int i = 1; i < longArray.length; i++) {
            if(longArray[i] > max) {
                max = longArray[i];
            }
        }

        return max;
    }
236398
function (arr) {
        var result = true;
        arr.forEach(function (elem) {
            if (!(typeof elem === 'string' || typeof elem === 'number')) {
                result = false;
            }
        });

        return result;
    }
938934
public static Object findFirstIn(Object obj, Object[] arr) {
		for (Object o : arr) {
			if (obj.equals(o)) {
				return o;
			}
		}
		return null;
	}
303281
public static int search(long[] longArray, long value) { 
        int start = 0;
        int end = longArray.length - 1;
        int middle = 0;
        
        while(start <= end) {
            middle = (start + end) >> 1;
        
            if(value == longArray[middle]) {
                return middle;
            }
            
            if(value < longArray[middle]) {
                end = middle - 1 ;
            }
            else {
                start = middle + 1;
            }
        }
                

        return -1;
    }
521940
public static INDArray toOffsetZero(INDArray arr) {
        if (arr.offset() < 1 && arr.data().length() == arr.length())
            if (arr.ordering() == 'f' && arr.stride(-1) != 1
                    || arr.ordering() == 'c' && arr.stride(0) != 1)
                return arr;

        if (arr.isRowVector()) {
            INDArray ret = Nd4j.create(arr.shape());
            for (int i = 0; i < ret.length(); i++)
                ret.putScalar(i, arr.getDouble(i));
            return ret;
        }

        INDArray ret = Nd4j.create(arr.shape(), arr.ordering());
        ret.assign(arr);
        return ret;
    }
853378
static long getLong(final byte[] arr, final long off) throws IOException {
        final int ioff = (int) off;
        if (ioff < 0 || ioff > arr.length - 8) {
            throw new IndexOutOfBoundsException();
        }
        return ((arr[ioff + 7] & 0xffL) << 56) //
                | ((arr[ioff + 6] & 0xffL) << 48) //
                | ((arr[ioff + 5] & 0xffL) << 40) //
                | ((arr[ioff + 4] & 0xffL) << 32) //
                | ((arr[ioff + 3] & 0xffL) << 24) //
                | ((arr[ioff + 2] & 0xffL) << 16) //
                | ((arr[ioff + 1] & 0xffL) << 8) //
                | (arr[ioff] & 0xffL);
    }
437997
public int getMaxValueIndex(double[] array) {

        int index = 0;
        double max = Integer.MIN_VALUE;

        for (int i = 0; i < array.length; i++) {
            if (array[i] > max) {
                max = array[i];
                index = i;
            }
        }

        return index;
    }
345899
public static void intIndexesToBooleanArray(int[] arra, boolean[] arrb) {

        for (int i = 0; i < arra.length; i++) {
            if (arra[i] < arrb.length) {
                arrb[arra[i]] = true;
            }
        }
    }
1309982
def get_max(array):
    
    largest = -np.inf
    for i in array:
        try:
            if i > largest:
                largest = i
        except:
            pass
    if np.isinf(largest):
        raise ValueError("there's no numeric value in array!")
    else:
        return largest
278159
public static int getDimension(INDArray arr, boolean defaultRows) {
        // FIXME: int cast

        //ignore ordering for vectors
        if (arr.isVector()) {
            return defaultRows ? (int) arr.rows() : (int) arr.columns();
        }
        if (arr.ordering() == NDArrayFactory.C)
            return defaultRows ? (int) arr.columns() : (int) arr.rows();
        return defaultRows ? (int) arr.rows() : (int) arr.columns();
    }
925917
public static <A> float[] toPrimitiveFloatArray(A array, NumberArrayAdapter<?, ? super A> adapter) {
    if (adapter == FLOATARRAYADAPTER) {
      return ((float[]) array).clone();
    }
    float[] ret = new float[adapter.size(array)];
    for (int i = 0; i < ret.length; i++) {
      ret[i] = adapter.getFloat(array, i);
    }
    return ret;
  }
709029
public static long[] getArrowStrides(INDArray arr) {
        long[] ret = new long[arr.rank()];
        for(int i = 0; i < arr.rank(); i++) {
            ret[i] = arr.stride(i) * arr.data().getElementSize();
        }

        return ret;
    }
420648
public static long vectorsPerSlice(INDArray arr, int... rank) {
        if (arr.rank() > 2) {
            return arr.size(-2) * arr.size(-1);
        }

        return arr.size(-1);

    }