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);
}
}