网上一个链接
http://download.csdn.net/detail/xiyuan2016/9554252
Java 解析xml:dom4j、JDOM
Java 解析Html:Jsoup
package com.test;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
public class SystemDemo {
public static void main(String[] args) throws IOException {
//获取操作系统环境变量
Map<String, String> map = System.getenv();
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println(entry.getKey()+"=====>"+entry.getValue());
}
System.out.println("--------------------------------------\n");
//获取Java版本等信息
Properties properties = System.getProperties();
Enumeration<?> enumeration = properties.propertyNames();
while (enumeration.hasMoreElements()) {
System.out.println(enumeration.nextElement()+"=====>"+System.getProperty(String.valueOf(enumeration.nextElement())));
}
System.out.println("--------------------------------------\n");
//Running
Runtime runtime = Runtime.getRuntime();
System.out.println("总内存="+runtime.totalMemory());
System.out.println("可用内存="+runtime.freeMemory());
System.out.println("处理器数量="+runtime.availableProcessors());
//打开QQ
// runtime.exec("C:\\Program Files (x86)\\Tencent\\QQ\\Bin\\QQScLauncher.exe");
//范围随机数
Random random = new Random();
System.out.println(random.nextInt(50));//0-49
ThreadLocalRandom random2 = ThreadLocalRandom.current();
int value = random2.nextInt(2, 5);//2-4
System.out.println(value);
}
}