* 배열.복사본(기존 배열, 크기) – 배열 크기 조정
* System.arraycopy byte() 유형 데이터를 자르거나 연결하는 데 사용되는 방법입니다.
System.arraycopy (src, srcPos, dest, destPos, 길이)
물체 소스 : 원래 배열
정수 소스Pos: 원래 배열의 시작 위치 복사, 데이터를 처음부터 읽으려면 0을 입력하십시오.
물체 목적지 : 복사할 배열, 복사하려는 대상입니다. -> 여기에 복사
정수 목적지Pos: 복사할 배열의 복사 시작 위치, 처음부터 데이터를 쓰려면 0을 입력합니다.
int 길이: 복사할 요소 수
public class Solution {
public int() addToFront(int() arr, int el) {
// TODO:
int () result = new int(arr.length+1);
result(0) = el;
System.arraycopy(arr, 0, result, 1, arr.length);
return result;
}
}
I/O 예시
int() output = addToFront(new int(){1, 2}, 3);
System.out.println(output); // -> (3, 1, 2)
![[Deep Dive] 46장 - [Deep Dive] 46장 -](https://excuse.jejusotong-letter.kr/wp-content/plugins/contextual-related-posts/default.png)
