[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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s