62,615
社区成员
发帖
与我相关
我的任务
分享
public class Memory_test
{
public static void main( String [] args ) throws Exception
{
Runtime r = Runtime.getRuntime();
long first = r.freeMemory();
int num[] = new int[100];
for(int i = 0;i<100;i++)
num[i] = i;
long second = r.freeMemory();
System.out.println(first-second);
}
}