def fix_jvm(fig):
    """Normalize memory usage reported by Java NMT to KB"""
    if fig.upper().endswith('MB'):
        return int(fig.strip('MB')) * 1024
    if fig.upper().endswith('KB'):
        return int(fig.strip('KB'))
    if fig.upper().endswith('B'):
        return int(fig.strip('B')) / 1024