集册 Java实例教程 复制数组范围

复制数组范围

欢马劈雪     最近更新时间:2020-01-02 10:19:05

460
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
复制数组范围


//package com.nowjava;
/*来自 
 nowjava - 时代Java*/

import java.util.Arrays;


public class Main {

    public static void main(String[] argv) throws Exception {

        String[] arr = new String[] { "1", "abc", "level", null,

                "nowjava.com", "asdf 123" };

        int startIndex = 2;

        int endIndex = 2;

        System.out.println(java.util.Arrays.toString(copyArrayRange(arr,

                startIndex, endIndex)));

    }


    public static String[] copyArrayRange(String[] arr, int startIndex,

            
展开阅读全文