Copy Elements from One Array to Another in Java
Description
The following code shows how to copy Elements from One Array to Another.
Example
//from ww w .j a va 2 s. com
public class Main {
public static void main(String[] argv) throws Exception {
int[] src = { 1, 2, 3 };
int[] dst = { 1, 1, 1 };
System.arraycopy(src, 0, dst, 0, Math.min(src.length, dst.length));
}
}
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »