The 1st part in a multidimensional array indicates the column (vertical)
position
The 2nd part in a multidimensional array indicates the row (horizontal)
position
The 3rd part in a multidimensional array is the depth position
Array[4]x[3]:
[][][][]
[][][][]
[][][][5]The value '5' is in position [2][3]
Array[4]x[3]x[3]:
[] [] []/ [][][][]
[5][][]/ [][][][]
The slash is used to indicate the depth or 3rd dimension of the array
The value '5' is in position [1][0][2]
I hope this helps :-)
On Sun, Feb 22, 2009 at 9:16 AM, <[email protected]> wrote:
> Franz:
>
> I will answer as many questions as I can:
>
> 1. The memory required for a 4x3 array of int would be 4 bytes per integer
> x 4 x 3 = 48 bytes total.
>
> 2. The easiest way to fill a 3D array like that would probably be with
> nested-for loops. i.e.:
>
> for (int i = 0; i < 50; i++) {
> for (int j = 0; j < 128; j++) {
> for (int k = 0; k < 256; k++) {
> num[i][j][k] = ...
> }
> }
> }
>
> 3. I can't think of an easy way to explain this one. A two-dimensional
> array is an "array of arrays" (for example, from question #1, an array of 4
> arrays of 3 int's). A 3D array is an expansion from that (an array of arrays
> of arrays). Sorry, I can't think of another way to say that.
>
> 4. I prefer to think of that situation as 50 rows, 128 columns and 256
> "layers". If you think of a box sitting on the floor, the length of the box
> would be, for example, the rows (say 50), the width of the box would be the
> columns (128), and the third number would be how far off of the floor (256).
> Don't know if that helps or not, but that's how I picture it.
>
> 5. How much memory is consumed would depend on the values that you are
> storing in the array. It would be (50x128x256) x the size of the type of
> data you're storing (4 for int, 1 for boolean, etc.).
>
> 6. I can't help you on this one. I haven't gotten up to GUI or AWT yet.
>
> Cheers!
> Eric
>
> On Feb 22, 2009 7:34am, franzgabriel <[email protected]> wrote:
> >
> >
> > Somebody help me please, I still struggling to understand array multi
> >
> > Dimension,
> >
> > My question is :
> >
> >
> >
> > 1. if I create 2 dimensional array 4 x 3 and the data type integer in
> >
> > 32 bit computer how much memory will consume? Is it still only 4 byte
> >
> > or become doubler ??
> >
> >
> >
> > 2. how to fill values in row & column after initialized fixed
> >
> > dimension size in 3 D array:
> >
> >
> >
> > int [ ][ ][ ] num;
> >
> > num = new int [50][128][256];
> >
> >
> >
> > 3. What does it means 50 x 128 x 256 in array 3 D?
> >
> >
> >
> > 4. in array 3D 50 is become Row, 128 is column, and the 256 is column,
> >
> > Is it right?
> >
> >
> >
> > 5. from above no.3 question the total is 1.651.200 field to store data
> >
> > value, How much a memory will consume?
> >
> >
> >
> > 6. What does array use for in our java programming actually in GUI
> >
> > (AWT)?? only store a value or any different purpose?
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---