在java中,有个很给力的方法arraycopy, 该方法在java.lang.System类中.
public static void arraycopy (Object src, int srcPos, Object dest, int destPos, int length)
-
Parameters:
-
src
- the source array. -
srcPos
- starting position in the source array. -
dest
- the destination array. -
destPos
- starting position in the destination data. -
length
- the number of array elements to be copied.
用起来感觉很爽。可以复制各种数组如byte[],int[],String[].