Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- public class ProcessTester {
- public static void main(String[] args) {
- Process one = new Process(3, 1);
- Process two = new Process(4, 8);
- Process three = new Process(9, 1);
- Process four = new Process(5, 6);
- Process five = new Process(7, 3);
- Process six = new Process(1, 4);
- Process[] processes= new Process[]{one, two, three, four, five, six};
- System.out.println("Before sorting...");
- for (Process p : processes) {
- System.out.println(p.toString());
- System.out.println();
- }
- System.out.println();
- Arrays.sort(processes, Process.ARRIVAL_TIME_COMPARATOR);
- System.out.println("After sorting, based on ARRIVAL time ordering");
- for (Process p : processes) {
- System.out.println(p.toString());
- System.out.println();
- }
- System.out.println();
- Arrays.sort(processes, Process.PROCESS_TIME_COMPARATOR);
- System.out.println("After sorting, based on PROCESS time ordering");
- for (Process p : processes) {
- System.out.println(p.toString());
- System.out.println();
- }
- }
- }
Add Comment
Please, Sign In to add comment