aspose file tools
The moose likes Beginning Java and the fly likes total number of rows in a multidimensional array Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "total number of rows in a multidimensional array" Watch "total number of rows in a multidimensional array" New topic
Author

total number of rows in a multidimensional array

nitinram agarwal
Ranch Hand

Joined: Jan 29, 2009
Posts: 77
Hello everyone,
I have a multidimensional array and would like to know what is the depth of it? For ex given the following 2 dimensional array


the total number of rows is 6. I would like to know if there is a direct way of determining the depth of a multi dimensional array. As of now, I am iterating through the array and computing it. for a one dimensional array, "length" gives me the total number of columns and I am looking towards something similar for row numbers.
Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129

bigMatrix.length will give you the total no. of rows.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 9940
    
    6

nitinram agarwal wrote:I have a multidimensional array

Actually, you don't. You have a one-dimensional array. It just happens to hold...arrays.


Never ascribe to malice that which can be adequately explained by stupidity.
nitinram agarwal
Ranch Hand

Joined: Jan 29, 2009
Posts: 77
thanks everyone. i knew that i might be asking something silly but kind of got a little confused.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: total number of rows in a multidimensional array
 
Similar Threads
multidimensional array creation
Multidimensional arrays
MultiDimensional Arrays
An array of multidimensional arrays?
Multidimensional Arrays