Java Array Max Value maxRowLen(Object[]... arr)

Here you can find the source of maxRowLen(Object[]... arr)

Description

max Row Len

License

Open Source License

Declaration

public static int maxRowLen(Object[]... arr) 

Method Source Code

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

public class Main {
    public static int maxRowLen(Object[]... arr) {
        return arr[maxRow(arr)].length;
    }//from  w ww. jav a  2  s  .co  m

    /**
     * Returns the first row's index having the maximum length in a 2D array.
     *
     * @param arr a 2D array
     * @return the index of the first instance of a longest row
     */
    public static int maxRow(Object[]... arr) {
        int maxRowLength = arr[0].length;
        int maxRow = 0;
        for (int i = 1; i < arr.length; i++) {
            if (maxRowLength < arr[i].length) {
                maxRowLength = arr[i].length;
                maxRow = i;
            }
        }

        return maxRow;
    }
}

Related

  1. maxPosition(float[] v)
  2. maxPositive(int[] array)
  3. maxPrim(final int... numbers)
  4. maxRepeating(int[] input, int k)
  5. maxRow(Object[]... arr)
  6. maxSize(String[] string)
  7. maxSort(double[] arr)
  8. maxStartFromIndex(double[] array, int startFromIndex)
  9. maxSum(int[] array)