Copy an Array in Java

In this post, we will see 5 methods to make a copy of an array in Java.


1. System.arraycopy()


Download   Run Code


2. Arrays.copyOf()


Download   Run Code


3. Arrays.copyOfRange()


Download   Run Code


4. Object.clone()


Download   Run Code


5. Apache Commons Lang – ArrayUtils.clone()




Thanks for reading.

Please use our online compiler to post code in comments.
Like us? Please spread the word and help us grow. Happy coding 🙂

Leave a Reply

Notify of