深入java数组:type[] copyOfRange(type[] original, int from,
时间:2014-04-13 09:11 来源: 我爱IT技术网 作者:微风
深入java数组:
type[] copyOfRange(type[] original, int from, int to)
功能:将数组按范围copy到另一数组
注意:范围的确切理解为[from, to),包括 from所指元素,但不包括 to 所指元素。
例子:
int[] a2 = new int[]{3, 4 , 6, 5};
int[] copy = Arrays.copyOfRange(a2,0,2);
System.out.println(Arrays.toString(copy)); // [3,4]
本文来源 我爱IT技术网 http://www.52ij.com/jishu/4976.html 转载请保留链接。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
