[Java] – How to check how many processors have available?

Below is the code for you check it :

public class QtyProcessorsTest {
    public static void main(String[] args) {
        Runtime runtime = Runtime.getRuntime();
        int qtyProcessors = runtime.availableProcessors();
        System.out.println("Qty processors: " + qtyProcessors);
    }
}

 

Leave a comment