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));
        
    }

}

 

posted @ 2019-04-20 22:53  Geek张东坡  阅读(714)  评论(0编辑  收藏  举报