Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20210616] Java System.arraycopy #150

Open
JuHyun419 opened this issue Jun 16, 2021 · 0 comments
Open

[20210616] Java System.arraycopy #150

JuHyun419 opened this issue Jun 16, 2021 · 0 comments
Labels

Comments

@JuHyun419
Copy link
Owner

JuHyun419 commented Jun 16, 2021

Java - System.arraycopy

  • Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.
  • static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
  • Object src: 복사하고자 하는 원본 소스(source)
  • int srcPost: 원본 소스에서 어느 위치(index)부터 읽어올 지
  • Object dest: 복사할 소스(destination)
  • int destPost: 복사본에서 어느 위치(index)부터 쓸 지 결정
  • int length: 복사본 배열의 크기

image

// newArr -> arr copy, 아래 for문과 동일
System.arraycopy(newArr, 0, arr, 0, arr.length);

for (int i = 0; i < arr.length; i++) {
    arr[i] = newArr[i];
}
@JuHyun419 JuHyun419 added the Java label Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant