Kotlin 1 Liner – Get number of available processors / CPU cores from runtime
An example Kotlin code snippet to show you how to get the number of available processors / cores / CPUs in your environment.
Get Available CPU's in Kotlin
You can also use this method to find number of cores in Java as well.
Output might vary depending on your machine. Here's the number of CPU available in my local machine