Runtime: availableProcessors() : Runtime « java.lang « Java by API






Runtime: availableProcessors()

  

public class Main {
  public static void main(String[] args) {
    Runtime runtime = Runtime.getRuntime();

    int nrOfProcessors = runtime.availableProcessors();

    System.out.println("Number of processors available to the Java Virtual Machine: "
        + nrOfProcessors);
  }
}
// Number of processors available to the Java Virtual Machine: 2

   
    
  








Related examples in the same category

1.Runtime: addShutdownHook(Thread hook)
2.Runtime: exec(String[] command)
3.Runtime: exec(String command) (2)
4.Runtime: freeMemory()
5.Runtime: gc()
6.Runtime.getRuntime()
7.Runtime: maxMemory()
8.Runtime: totalMemory()