Runtime: availableProcessors() : Runtime « java.lang « Java by API
- Java by API
- java.lang
- Runtime
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