Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java
Expertise: Intermediate
Oct 24, 2003



Application Security Testing: An Integral Part of DevOps

Copy One Array to Another Without Using Loops or Conditions

Here's the code the usage of arraycopy:

public class testarrcopy
 public static void main(String arg[])
   //Array of any object can be user defined object
   String source[] =

   //Array of any object can be user defined object
   String dest[] = new String[5];

   ...some conditions or calculations..

    *This method copies source array to destination Array.
    *It starts copy from the position 3 from source array.
    *If we didn't properly set the values to the function it may leads to
the exceptions like     *IndexOutOfBoundsException

   //the following loop tests the values in the dest array
   for(int i=0; i< dest.length; i++)

Elayaraja David
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date