aspose file tools*
The moose likes Java in General and the fly likes arraycopy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "arraycopy" Watch "arraycopy" New topic
Author

arraycopy

Gerry Martin
Greenhorn

Joined: Jul 31, 2001
Posts: 5
I am try to manipulate an 2D array, into a 1D array, but must also flip the 2D array, so that the last element of the 2D array is now the first element of the 1D array.
Sorta like a nested loop, where:
1D[0] = 2D[5][10];
1D[50] = 2D[0][0];
The arrays that I have to flip are used to draw an image using MemoryImageSource, so they are quite large(512x1024).
Is it posible to use arraycopy to get better performance in this situtation.
Mo Ibrahim
Greenhorn

Joined: Jul 10, 2001
Posts: 28
I think arrayCopy() is a native call and if I am right, it should be faster than a loop.
Gerry Martin
Greenhorn

Joined: Jul 31, 2001
Posts: 5
Arraycopy is faster than a loop, but how would you use arraycopy to convert a 2d array, into a 1d array, where the last element of the 2d array is the first elemet of the 1d array.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
For what you want to do, it sounds like a loop is your best bet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: arraycopy