01: package org.shiftone.cache.util;
02:
03: /**
04: * Class MemUtil
05: *
06: *
07: * @author <a href="mailto:jeff@shiftone.org">Jeff Drost</a>
08: * @version $Revision: 1.5 $
09: */
10: public class MemUtil {
11:
12: /**
13: * returns percent (100 based) of memory that is "free"
14: */
15: public static double freeMemoryPct() {
16:
17: Runtime runtime = Runtime.getRuntime();
18: double freeMemory = (double) runtime.freeMemory();
19: double totalMemory = (double) runtime.totalMemory();
20: double percentFree = freeMemory / totalMemory * 100.0;
21:
22: return percentFree;
23: }
24: }
|