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

Runtime.getRuntime().availableProcessors()

You can also use this method to find number of cores in Java as well.

Output

Output might vary depending on your machine. Here's the number of CPU available in my local machine

8