Added the methods deepCopyOf(U[] original, Class<? extends T[]> newType) and deepCopyOf(T[] original), that perform a deep copy of the structure of multidimensional arrays. Also, added a pre-calculation of the string builders capacity for toString() of primitive array types, based on the mold of BitSet.toString() method for pre-calculation of the initial capacity.
The deep copy is necessary for coping a multiarray that should be assigned to a field or returned by a getter method, to ensure that the data structure will not be modified externally of the class. The pre-calculation of the string builders capacity is an optimization to reduce the times that builders needs to grow their capacity. Link to the pull request: https://github.com/openjdk/jdk/pull/11815