File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes multidimensional array creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Java » Java in General
Bookmark "multidimensional array creation" Watch "multidimensional array creation" New topic

multidimensional array creation

Kelley Koszegi

Joined: Aug 20, 2001
Posts: 27
Here is an array problem I have:
I have two multi-dimensional arrays of the same size & shape, like this:

I want to get an array that looks like this:

How can I do this without explicitly copying each element of the array? It seems like I should be able to "plug" arrayA and ArrayB right into arrayC somehow. Any ideas?

Kelley Koszegi<br />Sun Certified Java Programmer
Steve Deadsea
Ranch Hand

Joined: Dec 03, 2001
Posts: 125
I believe you will have to copy each element. Java arrays are contiguous memory segments, so they cannot be created by mixing non-contiguous peices of memory.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: multidimensional array creation