首页 > 其他 > 详细

System类

时间:2020-07-06 19:58:08      阅读:42      评论:0      收藏:0      [点我收藏+]

System类

示例代码:

public class Demo3 {
    public static void main(String[] args) {
        //arrayCopy  数组复制
        int[] src = {12, 34, 45, 56, 67, 45};
        int[] dest = new int[8];
        System.arraycopy(src, 0, dest, 0, src.length); //1.原数组  2.从哪个位置开始赋值  3.目标数组  4.目标数组的位置  5.复制的长度
        for (int i = 0; i < dest.length; i++) {
            System.out.println(dest[i]);
        }

        //currentTimeMillis()   获取到现在的毫秒数  实现计时
        long start = System.currentTimeMillis();
        for (int i = -999999999; i < 9999999; i++) {
            for (int j = -999999; j < 9999999; j++) {
                int result = i + j;
            }
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);

        //gc()  告诉垃圾回收器回收垃圾


        //推出JVM
        System.exit(0);
        System.out.println("结束了"); 
    }

}

 

System类

原文:https://www.cnblogs.com/qiudajiang/p/13256267.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!