About 96,900 results
Open links in new tab
  1. Getting the array length of a 2D array in Java - Stack Overflow

    It was really hard to remember that. int numberOfColumns = arr.length; int numberOfRows = arr[0].length; Let's understand why this is so and how we can figure this out when we're given …

  2. java - Getting the length of two-dimensional array - Stack Overflow

    Expansion for multi-dimension array total length, Generally for your case, since the shape of the 2D array is "squared". int length = nir.length * nir[0].length; However, for 2D array, each row …

  3. java - How to get length of rows and columns in Two-Dimensional …

    Oct 13, 2013 · This image is what you call 2D array, as you can see, it's actually an array of arrays. nums.length will return the length of the blue array (which is the number of the rows). …

  4. arrays - length and length () in Java - Stack Overflow

    Dec 27, 2009 · In Java, an Array stores its length separately from the structure that actually holds the data. When you create an Array, you specify its length, and that becomes a defining …

  5. Java 2D array length - Stack Overflow

    Oct 4, 2018 · so when you try array.length you get 3 the first array that contains 3 arrays which contain 4 elements each, however when you array[0].length,array[1].length, array[2].length, …

  6. Find the dimensions of a 2D array in java - Stack Overflow

    Apr 10, 2016 · To get the actual length of the second dimension (which can be different for each array entry of the first dimension) do this: int[] findSize(int[][] inputArr) { int[] size = new …

  7. 2d Array length rows and column length (Java) - Stack Overflow

    Dec 31, 2018 · System.out.println(example.length); // number of rows System.out.println(example[0].length); // number of columns in first row But This could fail if: …

  8. java - Get the size of a 2D array - Stack Overflow

    Nov 6, 2010 · In Java, 2D arrays are really arrays of arrays with possibly different lengths (there are no guarantees that in 2D arrays that the 2nd dimension arrays all be the same length) You …

  9. java - How to dynamically increase size of a 2D array - Stack …

    Nov 29, 2013 · Note that new int[2][4] is an array of int[]; the int[] arrays in the int[][] array are all initially the same length, but there's no requirement that they remain the same length. Any …

  10. java - Difference between array.length and array [0].length in a …

    Mar 20, 2016 · Thus, there is more than one dimension. Each dimension has a length. With block.length you get the length of the first one (i.e. 50), with block[x].length, you get the length …

Refresh