daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 46 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. private long getFreeMemoryComputer() {
  2.     try {
  3.         OperatingSystemMXBean system = ManagementFactory.getOperatingSystemMXBean();
  4.         Method getFreeMemory = system.getClass().getMethod("getFreePhysicalMemorySize");
  5.         getFreeMemory.setAccessible(true);
  6.         return (long) getFreeMemory.invoke(system);
  7.     } catch (Exception e) {
  8.         return -1;
  9.     }
  10. }
  11.  
  12. private long getTotalMemoryComputer() {
  13.     try {
  14.         OperatingSystemMXBean system = ManagementFactory.getOperatingSystemMXBean();
  15.         Method getTotalMemory = system.getClass().getMethod("getTotalPhysicalMemorySize");
  16.         getTotalMemory.setAccessible(true);
  17.         return (long) getTotalMemory.invoke(system);
  18.     } catch (Exception e) {
  19.         return -1;
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top