import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
* Copyright xuanwu.com All right reserved.
*/
/**
* @author fisher
* @version 1.0 2010-5-20 下午04:09:51
*/
public class JavaLinux {
/**
* 获取cpu使用情况
* @return
* @throws Exception
*/
public double getCpuUsage() throws Exception {
double cpuUsed = 0;
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("top -b -n 1");// 调用系统的“top"命令
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String str = null;
String[] strArray = null;
while ((str = in.readLine()) != null) {
int m = 0;
if (str.indexOf(" R ") !&#