# What is the simplest way to set one array equal to another without linking them

**URL:** <https://discourse.processing.org/t/what-is-the-simplest-way-to-set-one-array-equal-to-another-without-linking-them/6827>\
**Category:** Beginners\
**Created:** [December 22, 2018, 5:16pm UTC](https://discourse.processing.org/t/what-is-the-simplest-way-to-set-one-array-equal-to-another-without-linking-them/6827 "2018-12-22T17:16:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [December 22, 2018, 5:43pm UTC](https://discourse.processing.org/t/what-is-the-simplest-way-to-set-one-array-equal-to-another-without-linking-them/6827/2 "2018-12-22T17:43:26Z")

</div>

```auto
int[] a = { 10, 10 };
int[] b = a.clone();

```

> [@Array Index Out of Bounds error on Array List](https://discourse.processing.org/t/array-index-out-of-bounds-error-on-array-list/3006/5):
>
> String[] originalArray = { "apple", "orange", "grape", "banana", "lemon" }; String[] clonedArray = originalList.clone();

> [@How to copy an array](https://discourse.processing.org/t/how-to-copy-an-array/5170/4):
>
> Just directly invoke method [clone()](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()) over the array container: nerd_face class Testos { final float[] a, b; Testos(final float... arr) { b = (a = arr).clone(); } }

---

_[View the full topic](https://discourse.processing.org/t/what-is-the-simplest-way-to-set-one-array-equal-to-another-without-linking-them/6827)._
