copyOfRange的应用
package com.Summer_0420.cn; import java.util.Arrays; /** * @author Summer * copyOfRange的应用 */ public class TestMethod07 { static int [] a = {1,2,3,4,5,6,7,8,9,10}; public static void main(String[] args) { cutArray(a); } private static void cutArray(int[] a2) { int [] b = Arrays.copyOfRange(a, 2,6);//截取a数组索引2-6之间的值 System.out.println(Arrays.toString(b)); } }