Wednesday, December 24, 2008

Are There Any Withdrawal Symptoms From Zeldox

Comparing Strings Array Copy

arrangements are an important way to save data. If we have to make a copy of arrangements we can make it in this way.

 public class Copy () {
int [] array = new int [55555];


} public int [] copyArray () {
int [] arraycopy = new int [Array.length]
for (int i = 0; i \u0026lt;Array.length; i + +)
arraycopy [i] = array [i];
arraycopy return;}


For each position we copy the value of an array to another, this is a way but there is a better and easier. For this review the documentation (API documentation ) Exists in the class System a method called arraycopy.

arraycopy public static native void (Object src, int srcPos, Object dest, int destPos, int length)

This method is native, so the copy will be made in memory segment making it faster. This method gives us the ability to copy also segments of the original arrangement.

 System.arraycopy (array, 5, array, 0, Array.length-5); 

Copying from the 5-position under

Bibliography:

Dactonta, Michael C. Monk, Eric, Keller Paul, Java Pitfalls, Wiley 2000;


0 comments:

Post a Comment