public static String getMemoryInfo ( final Unit unit ) { final long [ ] memory = getMemoryInfo ( ) ; for ( final Type type : Type . values ( ) ) { memory [ type . ordinal ( ) ] /= unit . getDenominator ( ) ; } final StringBuilder sb = new StringBuilder ( 100 ) ; sb . append ( "Memory (free/total/max): " ) ; sb . append ( memory [ Type . FREE . ordinal ( ) ] ) ; sb . append ( unit . getUnitString ( ) ) ; sb . append ( "/" ) ; sb . append ( memory [ Type . TOTAL . ordinal ( ) ] ) ; sb . append ( unit . getUnitString ( ) ) ; sb . append ( "/" ) ; sb . append ( memory [ Type . MAX . ordinal ( ) ] ) ; sb . append ( unit . getUnitString ( ) ) ; return sb . toString ( ) ; }
Get information about the current memory status of the JVM .