That is one way to do it. But it is very insecure because you now have two references to the array
You can reduce the risk of such errors with the
clone() method, which all arrays implement. That will only work reliably unchanged for an ordinary (one‑dimensional) array of primitives or immutable reference types.