Multidimensional Arrays Question

ok, so I am a little bit lazy, and I kind of need the answer quickish.

i have a multidimensional array of images(dont ask why) laid out like:

EncodedImage[][] eImg = new EncodedImage[4][10];

eImg[0][0] = imgLoader.image1();
eImg[0][1] = imgLoader.image2();
eImg[0][2] = imgLoader.image3();

eImg[1][0] = imgLoader.image3();
eImg[1][1] = imgLoader.image2();
eImg[1][2] = imgLoader.image3();

now i have a constructor which accepts an array of these images like

public Construct( EncodedImage[] enImg)

so my question is, can i use my multidimensional array to get only the array of images from say EncodedImage[0];
like could i do

Construct cons = new Construct( eImg[0] );

to get enImage[] to be the array of the images eImg[0][0], eImg[0][1], eImg[0][2]??

Tried to explain as best i could. Any advice would be appreciated


	public EncodedImage get_Val(int pos, EncodedImage ar[][]){
		int d_1 = pos / 10;
		int d_2 = pos % 10;
		return ar[d_1][d_2];
	}

=)

can you explain what the pos is for?

I think you ask this.


get_Val(0, eImg) == eImg[0][0]
get_Val(1, eImg) == eImg[0][1]
get_Val(39, eImg) == eImg[3][9]

Ups sorry i think i finally understand what you want :wink:


	int ar[][] = new int[3][3];
		
	int ar2[] = ar[0];// ar2[1] == ar[0][1]; 

If I know from start you ask this, then I even not start Reply you – for so easy question XD

yes you can, but why did you not just tried it???
press compile button -> max 5sec
ask in forum -> several days

Thanks everyone, and because the program is all backwards, and to actually test it i would need to add a ton of code to a lot of files before finding out if it worked. then i’d need to delete that code again.

Just create a temp package in your project, and make a throwaway class in there to experiment with multidimensional arrays. No need to change any of your real code.