zoukankan      html  css  js  c++  java
  • java System

    1、获取系统当前的时间(毫秒)

    与Date类中getTime()方法相似

    package cn.wt.day12;
    
    import java.util.Date;
    
    public class Demon03 {
        public static void main(String[] args) {
            long systemTime = System.currentTimeMillis();
            System.out.println(systemTime);
            Date date = new Date();
            System.out.println(date.getTime());
        }
    }

    2、数组copy

    语法(看源码注释)

    arraycopy(Object src,  int  srcPos, Object dest, int destPos, int length)

    src 原数组

    srcPos 原数组的index

    dest 目标数组

    destPos 目标数组的index

    length 替换的长度

    例子

    package cn.wt.day12;
    
    
    import java.util.Arrays;
    import java.util.Objects;
    
    public class Demon03 {
        public static void main(String[] args) {
            long currentTime = System.currentTimeMillis();
            System.out.println(currentTime);
    
            int[] src = {1, 2, 3, 4, 5, 6};
            int[] dest = {6, 5, 4, 3, 2, 1};
            System.out.println(Arrays.toString(dest));  // [6, 5, 4, 3, 2, 1]
            System.arraycopy(src, 0, dest, 0, 3);
            System.out.println(Arrays.toString(dest)); // [1, 2, 3, 3, 2, 1]
        }
    }
  • 相关阅读:
    一个BUG显示了IE7和IE6解析URL中中文参数能力的不同
    Winform+Webservice小结
    精通 JS正则表达式
    JSON
    Jquery
    MongoDB 驱动实践
    概要设计(总体设计)
    LINQ 学习
    MongoDB培训
    数据流程图(需求分析方法和建模工具)
  • 原文地址:https://www.cnblogs.com/wt7018/p/12291690.html
Copyright © 2011-2022 走看看