This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

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]
Have you checked out Aspose?
subject: multidimensional array creation
jQuery in Action, 3rd edition