RunTime
class provides availableProcessors() method, to get the number of
processors available to JVM.
public class AvailableProcessors { public static void main(String args[]){ Runtime r = Runtime.getRuntime(); System.out.print("Available processors are "); System.out.println(r.availableProcessors()); } }
Sample
Output
Available processors are 4
No comments:
Post a Comment