Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (3.5k points)

How can I find the number of cores available to my application from within Java code?

1 Answer

0 votes
by (46k points)

int cores = Runtime.getRuntime().availableProcessors();

If cores are less than one else processor is about to die, or your JVM has a dangerous bug in it, or the universe is about to flip.

Related questions

0 votes
1 answer
0 votes
0 answers
asked Feb 18, 2021 in Java by Harsh (1.5k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...