Java Runtime get number of processors available to JVM
public class Main { public static void main(String[] args) { // Get the Runtime instance Runtime rt = Runtime.getRuntime(); // Print the number of processors available to the JVM int processors = rt.availableProcessors(); System.out.format("Number of processors = %d%n", processors); }//from w ww . ja va 2 s. c om }