Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multidimensional array creation

 
Kelley Koszegi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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?
Thanks,
--Kelley
 
Steve Deadsea
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.arraycopy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic