Here you can find the source of maxRow(Object[]... arr)
Parameter | Description |
---|---|
arr | a 2D array |
public static int maxRow(Object[]... arr)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w ww . java 2s . com*/ * 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; } }