Constructor and Description |
---|
GetMem() |
Modifier and Type | Method and Description |
---|---|
private <T> T |
callMXBeanMethod(String methodName,
T defaultValue)
Call a method belonging to
OperatingSystemMXBean and return
the result. |
static String |
getMemory()
Get total system memory and print it out--accounts for 32bit JRE
limitation of 1.5GB.
|
static void |
main(String[] args)
The main.
|
public GetMem()
private <T> T callMXBeanMethod(String methodName, T defaultValue)
OperatingSystemMXBean
and return
the result.T
- Type of the expected return and defaultValue
.methodName
- Name of the OperatingSystemMXBean
method to call. Cannot be null
or empty.defaultValue
- Value to return if the call to methodName
fails.methodName
call, or defaultValue
.public static String getMemory() throws Exception
String
representation of the total amount of system
memory.Exception