Novice neighborhoods: System.arrayCopy usage

Category: Web Develop
 
lovefish521
2010-08-20 12:00:49

Sponsored Links
Can System.arraycopy (students, 0, studentCopy, 0, students.length); these words inside the brackets mean explain in detail what thank you

Sponsored Links

lerirepathos0919
2010-08-20 12:02:53
copied from the specified source array an array copied from the specified position to the specified position of the destination array. From the source array referenced by src to dest destination array references, a subsequence of array components are copied down. The number of components copied is equal to the length argument. Source array location srcPos to srcPos + length-1, respectively, between the components are copied to the destination array destPos to destPos + length-1 position.
If src and dest arguments refer to the same array object, then the copying is performed as if the first srcPos to srcPos + length-1 position of the component to the a temporary array with length components and then copy the contents of this temporary array to the destination array destPos to destPos + length-1 position of the same.

If If dest is null, a NullPointerException exception.

If src is null, a NullPointerException exception, and does not modify the target array.

Otherwise, as long as any of the following conditions are true, an ArrayStoreException is thrown and the destination array is not modified:

src argument refers to a non- array object.
dest argument refers to a non-array object.
src argument and dest argument refers to those whose basic component types for different types of arrays.
src argument refers to an array with a primitive component type and the dest argument refers to an array with a reference component type.
src argument refers to an array with a reference component type and the dest argument refers to an array with a primitive component type.
Otherwise, if any of the following conditions is true, an IndexOutOfBoundsException exception and does not modify the destination array:

srcPos argument is negative.
destPos argument is negative.
length parameter is negative.
srcPos + length is greater than src.length, the length of the source array.
destPos + length is greater than dest.length, ie, the length of the target array.
Otherwise, if the source array srcPos to srcPos + length-1 position by assigning the actual component can not be converted into the target array component type is thrown ArrayStoreException exception. In this case, k is set to smaller than the length of the smallest non-negative integer, so will not be able src [srcPos + k] converted to the target array component type; when an exception is thrown, From srcPos to srcPos + k-1 position of the source array components have been copied to the target array destPos to destPos + k-1 position, and the destination array to another location not modified. (As it has been described in detail for those limitations, this paragraph can only be effectively applied to the two arrays are reference types component type of situation.)

old33man
2010-08-20 12:15:02
public static void arraycopy (Object src,
int srcPos,
Object dest,
int destPos,
int length)
domylove11
2010-08-20 12:30:20
main floor, first check the API documentation Institute, Chinese version of the address below
dianda201
2010-08-20 12:34:55
Parameters:
src - the source array.
srcPos - source array starting position.
dest - the destination array.
destPos - target data in the starting position.
length - to copy number of array elements.
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.