yingzhor 发表于 2013-2-5 08:49:38

获得处理器的数量

public class Main {      /**   * Displays the number of processors available in the Java Virtual Machine   */    public void displayAvailableProcessors() {                Runtime runtime = Runtime.getRuntime();                int nrOfProcessors = runtime.availableProcessors();                System.out.println("Number of processors available to the Java Virtual Machine: " + nrOfProcessors);            }      /**   * Starts the program   *   * @param args the command line arguments   */    public static void main(String[] args) {      new Main().displayAvailableProcessors();    }}

代码来自CSDN
页: [1]
查看完整版本: 获得处理器的数量