Use System.arraycopy instead of for loop