Get Number of Available Processors : Runtime « Development Class « Java
- Java
- Development Class
- Runtime
Get Number of Available Processors
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