void java.lang.System.arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
public class dailyCode { public static void main(String[] args) { int[] src = {1, 2, 3, 4, 5}; int[] dst = {0, 0, 0, 0, 0, 6, 7, 8, 9, 10}; int[] newSrc = {0, 0, 0, 0, 0};
System.arraycopy(src, 0, dst, 0, src.length);
for(int i : dst) { System.out.print(i + " "); } System.out.println("");
System.arraycopy(newSrc, 0, dst, 5, src.length); for(int i : dst) { System.out.print(i + " "); } System.out.println("");
System.arraycopy(newSrc, 0, dst, 1, 2); for(int i : dst) { System.out.print(i + " "); } } } |
'프로그래밍 > JAVA' 카테고리의 다른 글
Arrays class Example (0) | 2016.11.23 |
---|---|
Hashtable and HashMap Example (0) | 2016.11.21 |
Generics and Wildcard (0) | 2016.11.20 |
scheduleAtFixedRate vs. scheduleWithFixedDelay (0) | 2016.11.18 |
Callback using interface (0) | 2016.11.17 |
Singleton Design Pattern (0) | 2016.11.16 |
초기화 블록 (Initialization Block) (0) | 2016.11.15 |