<div style='background-color: none transparent;'></div>
Home » » Get Available Processors using Java Runtime Example

Get Available Processors using Java Runtime Example

/*
Get Available Processors using Java Runtime Example
This Java example shows how to get number of processors
available to current Java Virtual Machine (JVM).
*/
public class GetAvailableProcessors {

public static void main(String args[])
{
/*
* get current Java Runtime using getRuntime()
* method of Runtime class.
*/
Runtime runtime = Runtime.getRuntime();

/*
* use availableProcessors method to determine
* how many processors are available to the Java Virtual
* Machine (JVM).
*/

int numberOfProcessors = runtime.availableProcessors();

System.out.println(numberOfProcessors + " processor available to JVM");
}
}

/*
Typical output of this program would be,
1 processor available to JVM
*/
Share this article :
 
Copyright © 2011. B.Sc B.Tech MCA Ploytechnic Mini,Main Projects | Free Main Projcets Download | MCA |B.tech . All Rights Reserved
Company Info | Contact Us | Privacy policy | Term of use | Widget | Advertise with Us | Site map
Template Modify by Creating Website. Inpire by Darkmatter Rockettheme Proudly powered by Blogger