And when the times comes to reset clonedArray back to the contents of originalArray, use arrayCopy():
arrayCopy(originalArray, clonedArray);
Also be aware that such cloning & copying techniques are shallow!
And they should be used only for primitive and immutable datatypes!
Docs.Oracle.com/javase/10/docs/api/java/lang/Object.html#clone()
Thus, this method performs a “shallow copy” of this object, not a “deep copy” operation.