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]
        }
    }
  • 相关阅读:
    html中的浮动
    Html中元素的分类
    前端标签命名规范
    meta详解
    CSS的嵌套方法
    html标签
    W3C标准
    AE待整理
    AE小知识点备忘录
    Maximum Subarray
  • 原文地址:https://www.cnblogs.com/wt7018/p/12291690.html
Copyright © 2011-2022 走看看