admin管理员组文章数量:1635848
2019独角兽企业重金招聘Python工程师标准>>>
/***
* From java doc: If the src and dest arguments refer to the same array object,
* then the copying is performed as if the components at positions srcPos through
* srcPos+length-1 were first copied to a temporary array with length components
* and then the contents of the temporary array were copied into positions destPos
* through destPos+length-1 of the destination array
*/
public class ArraycopyTest {
public static void main(String args[]) {
int[] scores = {1, 2, 3, 4, 5, 6};
System.arraycopy(scores, 2, scores, 3, 3);
for (int i : scores)
System.out.print(i);
}
}
123345
It‘s safe
转载于:https://my.oschina/u/2935389/blog/3033012
本文标签: SafearraycopySystemArraydestination
版权声明:本文标题:Is System.arraycopy safe when the source and destination are the same array? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729215637a1190398.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论