How to increase an array’s length

If you don’t want or cannot use ArrayList, then there is a utility method:

Arrays.copyOf() 

that will allow you to specify new size, while preserving the elements.

Leave a Comment