zoukankan      html  css  js  c++  java
  • 类System

    /*
    * public static void gc();运行垃圾回收器
    * public static void exit(int status);终止当前正在运行的Java虚拟机。参数用作状态码;根据惯例,非0的状态码表示异常终止
    * public static long currentTimeMillis();返回以毫秒为单位的当前时间
    *
    * public static void arraycopy(Object src,int srcPos,Object dest,int destPos,int length);
    * 从指定源数组中复制一个数组,复制从指定的位置开始,到目标数组的指定位置结束
    * */

    public static long currentTimeMillis();返回以毫秒为单位的当前时间

    统计该段程序的运行时间

    /*
     * public static void gc();运行垃圾回收器
     * public static void exit(int status);终止当前正在运行的Java虚拟机。参数用作状态码;根据惯例,非0的状态码表示异常终止
     * public static long currentTimeMillis();返回以毫秒为单位的当前时间
     * 
     * public static void arraycopy(Object src,int srcPos,Object dest,int destPos,int length);
     * 从指定源数组中复制一个数组,复制从指定的位置开始,到目标数组的指定位置结束
     * */
    
    public class IntegerDemo {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    
    		long start = System.currentTimeMillis();
    
    		for (int i = 0; i < 100000; i++) {
    			System.out.println("hello" + i);
    		}
    
    		long end = System.currentTimeMillis();
    
    		System.out.println("共耗时" + (end - start) + "毫秒");// 统计该段程序的运行时间
    	}
    }
    

    * public static void arraycopy(Object src,int srcPos,Object dest,int destPos,int length);
    * 从指定源数组中复制一个数组,复制从指定的位置开始,到目标数组的指定位置结束

    import java.util.Arrays;
    
    /*
     * public static void gc();运行垃圾回收器
     * public static void exit(int status);终止当前正在运行的Java虚拟机。参数用作状态码;根据惯例,非0的状态码表示异常终止
     * public static long currentTimeMillis();返回以毫秒为单位的当前时间
     * 
     * public static void arraycopy(Object src,int srcPos,Object dest,int destPos,int length);
     * 从指定源数组中复制一个数组,复制从指定的位置开始,到目标数组的指定位置结束
     * */
    
    public class IntegerDemo {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    
    		int arr[] = { 11, 22, 33, 44, 55 };
    		int arr2[] = { 6, 7, 8, 9, 10 };
    
    		System.out.println(Arrays.toString(arr));
    		System.out.println(Arrays.toString(arr2));
    
    		System.arraycopy(arr, 1, arr2, 2, 2);// 从指定源数组中复制一个数组,复制从指定的位置开始,到目标数组的指定位置结束
    
    		System.out.println(Arrays.toString(arr));
    		System.out.println(Arrays.toString(arr2));
    	}
    }
    
  • 相关阅读:
    python学习笔记之小小购物车
    TestNg学习一
    网监利器镜像——原理配置篇
    改变人生的31个黄金思维
    培养人脉的106个技巧
    CIR,CBS,EBS,PIR,PBS傻傻分不清楚?看这里!—-揭秘令牌桶
    请别浪费你30岁前的时光,职场“35岁现象”
    VRRP主备备份配置示例—实现网关冗余备份
    关于JS的prototype
    使用 Bootstrap Typeahead 组件
  • 原文地址:https://www.cnblogs.com/denggelin/p/6284923.html
Copyright © 2011-2022 走看看