2019-08-29 11:42阅读: 15565评论: 1推荐: 5

3分钟了解Java中System.arraycopy的用法

System提供了一个静态方法arraycopy(),我们可以使用它来实现数组之间的复制。其函数原型是:

public static native void arraycopy(Object src,int srcPos,Object dest, int destPos,int length)
* @param      src      the source array. 源数组
* @param      srcPos   starting position in the source array. 源数组的起始位置
* @param      dest     the destination array. 目标数组
* @param      destPos  starting position in the destination data. 目标数组的起始位置
* @param      length   the number of array elements to be copied. 复制的长度

举个栗子:

将array数组复制到新的数组中;

int[] array = {1, 2, 3, 4, 5};
int[] targetArr = new int[array.length];
System.arraycopy(array,0,targetArr,0,array.length);

本文作者:benjieqiang

本文链接:https://www.cnblogs.com/benjieqiang/p/11428832.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   benjieqiang  阅读(15565)  评论(1编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
🔑
  1. 1 蒹葭(古筝版) 徐潮城
蒹葭(古筝版) - 徐潮城
00:00 / 00:00
An audio error has occurred.

作词 : 诗经

作曲 : 徐潮城

蒹葭-徐潮城

编:刘文

蒹葭苍苍白露为霜

所谓伊人在水一方

溯洄从之道阻且长

溯游水中央

蒹葭萋萋白露未晞

伊人在水湄

溯洄从之道阻且跻

溯游水中坻

蒹葭苍苍白露为霜

所谓伊人在水涘

伊人在水一方

蒹葭采采白露未已

溯洄从之道阻且右

溯游水中沚

蒹葭萋萋白露未晞

伊人在水湄

溯洄从之道阻且跻

溯游水中坻

蒹葭苍苍白露为霜

所谓伊人在水涘

伊人在水一方

蒹葭采采白露未已

溯洄从之道阻且右

溯游水中沚

蒹葭苍苍白露为霜

所谓伊人在水涘

伊人在水一方

蒹葭采采白露未已

溯洄从之道阻且右

溯游水中沚