代码如下:/** * Gets the number of cores available in this device, across all processors. * Requires: Ability to peruse the filesystem at “/sys/devices/system/cpu” * return The number of cores, or 1 if failed to get result */ private int getNumCores() { /