Skip to content

Instantly share code, notes, and snippets.

@tacksoo
Created April 9, 2013 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tacksoo/5345797 to your computer and use it in GitHub Desktop.
Save tacksoo/5345797 to your computer and use it in GitHub Desktop.
Print out the number of cores
public class Core {
public static void main(String[] args) {
int coreNum = Runtime.getRuntime().availableProcessors();
System.out.println("Number of cores are: " + coreNum);
long maxMemory = Runtime.getRuntime().maxMemory();
System.out.println("MAX size of the heap (MB): " + maxMemory / 1048576);
long freeMemory = Runtime.getRuntime().freeMemory();
System.out.println("Free size of the heap (MB): " + freeMemory / 1048576);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment