System

1.arraycopy 

import java.util.Arrays;
//arraycopy(Object src, int srcPos, Object dest, int destPos, int length) 
//从指定源数组中复制一个数组,复制从指定的位置开始,到目标数组的指定位置结束。

//src - 源数组。
//srcPos - 源数组中的起始位置。
//dest - 目标数组。
//destPos - 目标数据中的起始位置。
//length - 要复制的数组元素的数量。
public class System1 
{
	public static void main(String[] args) 
	{
		int[] SrcArr = {1,56,69,9,3,};
		int[] destArr = new int[4];
		System.arraycopy(SrcArr, 2, destArr, 0, 2);
		System.out.println(Arrays.toString(destArr));
		//[69, 9, 0, 0]
	}
}

2.

import java.io.IOException;
import java.util.Properties;


//System.currentTimeMillis()
//当前时间与过去某一个时刻的差值
//exit() 退出jvm
//gc() 	建议jvm赶快启动垃圾回收器
//System.getenv("JAVA_HOME") 返回一个环境变量
//System.getProperties(); 返回系统信息

public class CurrentTimeMillis1 
{
	public static void main(String[] args)throws IOException, InterruptedException {
		System.out.println(System.currentTimeMillis());
		//System.exit(1);//无论是0和1都退出
		System.out.println("hello world");
		System.out.println(System.getenv("JAVA_HOME"));
//		Properties p = System.getProperties();
//		p.list(System.out);
		String s = System.getProperty("os.name");//显示一个属性
		System.out.println(s);
		Runtime runtime = Runtime.getRuntime();//throws IOException
		Process process = runtime.exec("C:\\Windows\\notepad.exe");//启动记事本
		Thread.sleep(500);//throws InterruptedException
		process.destroy();//杀死子进程  把记事本关掉
		System.out.println("jvm中的空闲内存量"+ runtime.freeMemory());
		System.out.println("jvm中的空闲内存量"+ runtime.maxMemory());
		System.out.println("jvm中的空闲内存量"+ runtime.totalMemory());
		
	}
}

运行结果:

1476706657681
hello world
D:\jdk\
Windows 8
jvm中的空闲内存量127244592
jvm中的空闲内存量1892155392
jvm中的空闲内存量127926272
 

转载于:https://my.oschina.net/Ant95/blog/759702

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值