Copying array to another array


Sometimes it is required to copy array to another array, how can we do that?

Here is the things,

In the java.lang.system class we have System.arrayCopy(-,-.....); we can utlize these method to copy the array.

Here is the method : System.arraycopy(src, srcPos, dest, destPos, length);

Here we have 2 array fields , which we need to copy into the String [] finalfields array.

Calculating the finalfields array size

Here we have copied the "userField" array values into the "finalfields" array values.

Finally we copied the "addressFields" into the "finalfields" array.

so the "finalfields" array contains both "userField" and "addressFields" values.

Comments

  1. Thank you.it is really helpful.
    Check out these 5 Secrets: How To Use professional resume writing service To Create A Successful Business(Product)

    ReplyDelete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate