java进阶 -System类 -currentTimeMillis返回时间毫秒值 -arraycopy数组拷贝40

 

 currentTimeMillis:

package com.cyjt97.SY;

public class ay {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        String s = "";
        for (int i = 0; i <100000 ; i++) {
            s +=i;
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }
}

  

 

 

package com.cyjt97.SY;

public class ay {
    public static void main(String[] args) {
//        long start = System.currentTimeMillis();
//        String s = "";
//        for (int i = 0; i <100000 ; i++) {
//            s +=i;
//        }
//        long end = System.currentTimeMillis();
//        System.out.println(end-start);
        int arr[] = {11,22,33,44,55,66};
        int dayArr[] = new int[3];
        System.arraycopy(arr,1 ,dayArr,0,3);
        for (int i = 0; i < dayArr.length; i++) {
            System.out.println(dayArr[i]);
        }
    }
}

  

posted @ 2023-03-17 15:02  文采呱呱  阅读(28)  评论(0编辑  收藏  举报