wood burning stoves 2.0*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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: 83
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: 10916
    
  12

nitinram agarwal wrote:I have a multidimensional array

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


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
nitinram agarwal
Ranch Hand

Joined: Jan 29, 2009
Posts: 83
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://aspose.com/file-tools
 
subject: total number of rows in a multidimensional array
 
Similar Threads
multidimensional array creation
An array of multidimensional arrays?
MultiDimensional Arrays
Multidimensional arrays
Multidimensional Arrays