public static Vector<Integer> store = new Vector<>();
for(int i = 0; i < 256 * 1024 ; i ++){
store.add(0);
}
//系统置为system
for(int i = 0; i < 56 * 1024 ; i ++){
store.set(i, 1);
}
我设置了一个长度为256*1024的数组。(模拟内存,256MB),0表示空闲内存。1表示被占用的内存 public static Vector store = new Vector(); for(int i = 0; i < 256 * 1024 ; i ++){ store.add(0); } //系统置为system for(int i = 0; i < 56 * 1024 ; i ++){ store.set(i, 1); } 然后我想用一个矩形图来模拟内存中的状态