---
title: "如何得到Java应用程序的可用内存？"
author: "fish8077"
date: "2011-02-22T10:38:16Z"
tags: []
categories: ["编程语言"]
slug: "java"
draft: false
lastmod: "2011-02-22T10:38:32Z"
id: 914256
url: "https://fish8077.iteye.com/blog/914256"
---

```java

public class MemoryExp {
    public static void main(String[] args) {
        System.out.println("Total Memory"+Runtime.getRuntime().totalMemory()); 
        System.out.println("Free Memory"+Runtime.getRuntime().freeMemory());
    }
}

```