Skip to content

Instantly share code, notes, and snippets.

@arwankhoiruddin
Last active July 20, 2018 07:09
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 arwankhoiruddin/99b4cc4c66d6944b9588986b67ef10a2 to your computer and use it in GitHub Desktop.
Save arwankhoiruddin/99b4cc4c66d6944b9588986b67ef10a2 to your computer and use it in GitHub Desktop.
Get available processor and free memory using Java
import java.util.*;
public class GetInfo {
public static void main(String[] args) {
Properties p = System.getProperties();
// p.list(System.out);
System.out.println("Total CPU: " + Runtime.getRuntime().availableProcessors());
System.out.println("Free memory: " + Runtime.getRuntime().freeMemory());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment