Get the available processor
int availableProcessors()
- Returns the number of processors available to the Java virtual machine.
public class Main {
public static void main(String[] args) {
Runtime runtime = Runtime.getRuntime();
System.out.println(runtime.availableProcessors());
}
}
The output:
2