How do I know how many cores there are in Java?

Asked 2 years ago, Updated 2 years ago, 25 views

Is there a way to know how many cores my app can use in Java code?

java

2022-09-22 14:16

1 Answers

int cores = Runtime.getRuntime().availableProcessors(); If the core is less than one, the processor will die or a serious bug in the JVM.


2022-09-22 14:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.