• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

黄文超

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

java常用类--System类

java常用类--System类

常用方法

1、System.currentTimeMillis()

public class Demo07 {
    /**
     * currentTimeMillis返回从1970年开始到现在的一个时间戳,返回为long类型
     */
    public static void main(String[] args) {
        long time = System.currentTimeMillis();
        System.out.println(time);
    }
}

2、System.arraycopy()

import java.util.Arrays;
public class Demo07 {
    /**
     * 将数组的中的一段数据赋值到数组2中
     * 此代码中就是把arr1中的代码从1开始复制到arr2中2开始的位置,总共赋值3个长度
     */
    public static void main(String[] args) {
        int[] arr1 = {1,2,3,4,5,6};
        int[] arr2 = {21,22,23,24,25,26};
        System.arraycopy(arr1,1,arr2,2,3);
        System.out.println(Arrays.toString(arr2));
    }
}

posted on 2021-03-16 09:05  黄文超  阅读(48)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3