File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do to use ArrayCopy?

 
Travis Gn
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried copying arrays:
array1 = array2;
It's not working. Someone said to copy an array you need to use Arraycopy I don't know how to use this? Any help?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assigning array1=array2 will, as you have probably already figured out, just give you two pointers to the same array.
To copy any array, you can use the static method arraycopy() in the java.lang.System class, like this:

To find out what the various parameters mean, see the Javadoc for this method.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic