此程序运行于Java 16.0.2 环境中,在windows系统
public class partition {
public int size; //分区大小
public int head; //分区首地址
public boolean state; //分区是否空闲,true为空闲,false为繁忙
public static final int minSize = 5; //碎片最小值
public static LinkedList<partition> partitionList = new LinkedList<>(); //存储分区信息
public static int pointer = 0; //作指针,指向上一次查找结束的地址
public static int flag = 0; //记录每次执行后错误的类型
public static int maxSize = 1024; //内存最大值,1024为默认值
}
public class firstFit {
public static void first(int size) {
int i=0; //从最高地址开始找
for (;i < main.partitionList.siz