zoukankan      html  css  js  c++  java
  • System类

    System类

    • 1、public static long currentTimeMillis()返回当前时间(以毫秒为单位)。

      请注意,虽然返回值的时间单位为毫秒,但该值的粒度取决于底层操作系统,并且可能较大。

      例如,许多操作系统以几十毫秒为单位测量时间。

    • 2、public static void arraycopy(Object src,int srcPos,Object dest,int destPos,int length)

      将指定源数组中的数组从指定位置复制到目标数组的指定位置。

      参数:

      src - 源数组。

      srcPos - 源数组中的起始位置。

      dest - 目标数组。

      destPos - 目的地数据中的起始位置。

      length - 要复制的数组元素的数量。

    public class MySystem {
      public static void main(String[] args) {

          long l = System.currentTimeMillis();
          for (int i = 0; i < 9999; i++) {
              System.out.println(i);
          }
          long timeMillis = System.currentTimeMillis();
          System.out.println(timeMillis - l);//毫秒

          int[] src = {1,2,3,4,5};
          int[] dest = {6,7,8,9};
          System.out.println("复制前:" + Arrays.toString(dest));
          System.arraycopy(src,1,dest,2,2);
          System.out.println("复制后:" + Arrays.toString(dest));
      }
    }
    结果:
    复制前:[6, 7, 8, 9]
    复制后:[6, 7, 2, 3]
  • 相关阅读:
    垃圾处理现状
    买了个学生阿里云114元啊,安装mysql
    4 存储器
    3 总线
    崔大哥说基础很重要
    idea使用小积累mac
    为啥要用left join on where这样的东西
    观察者模式
    从shell中退出python命令
    locust性能测试入门
  • 原文地址:https://www.cnblogs.com/lxy522/p/12814277.html
Copyright © 2011-2022 走看看