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]
  • 相关阅读:
    天平称重【递归解法】
    天平称重【三进制巧解】
    天平称重【暴力解】
    奇怪的捐赠
    日期问题
    承压计算
    python学习(3)关于交互输入及字符串拼接
    python学习(2)关于字符编码
    python学习(1)python的基本概念
    Spring整合kafka消费者和生产者&redis的步骤
  • 原文地址:https://www.cnblogs.com/lxy522/p/12814277.html
Copyright © 2011-2022 走看看