This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler 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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC 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
It's not a secret anymore!