try it with bubble sort...
Code:
int process = 3;
String name[] = {"P1", "P2", "P3"};
int BurstT[] = {10, 6, 8};
int ArrivalT[] = {2, 1, 0};
int tempAT, tempBT;
String tempname;
boolean check = false;
do{
check=false;
for (int i=0;i < (process-1); i++){
if (ArrivalT[i] > ArrivalT[i+1]){
tempAT=ArrivalT[i];
ArrivalT[i]=ArrivalT[i+1];
ArrivalT[i+1]=tempAT;
tempBT=BurstT[i];
BurstT[i]=BurstT[i+1];
BurstT[i+1]=tempBT;
tempname= name[i];
name[i]= name[i+1];
name[i+1]=tempname;
check=true;
}
}
}while(check);
for(int x=0;x!=process;x++) {
System.out.println("||" + name[x] + "||" + BurstT[x] + "||" + ArrivalT[x] + "");
}