public static int xmx2MB ( String xmx ) { int size = 200 ; if ( xmx == null || xmx . isEmpty ( ) ) { return size ; } String s = xmx . substring ( xmx . length ( ) - 1 , xmx . length ( ) ) ; int unit = - 1 ; int localSize = - 1 ; if ( unitMap . get ( s ) == null ) { localSize = Integer . valueOf ( xmx . substring ( 4 , xmx . length ( ) ) ) ; return localSize / 1024 / 1024 ; } else { unit = unitMap . get ( s ) ; localSize = Integer . valueOf ( xmx . substring ( 4 , xmx . length ( ) - 1 ) ) ; } switch ( unit ) { case K : size = localSize / 1024 ; break ; case M : size = localSize ; break ; case G : size = localSize * 1024 ; break ; } return size ; }
- Xmx to MByte