Import Java. util. arraylist; import Java. util. arrays; import Java. util. collections; import Java. util. comparator; import Java. util. list; Class Job implements comparable <job> {int T1; int T2; int ID; public job (int id, int T1, int T2) {This. id = ID; this. t1 = T1; this. t2 = t2;} public int compareto (job o) {// T1 non-descending sorting if (this. t1 <O. t1) Return-1; elsereturn 1 ;}} class com implements comparator <job> {public int compare (job O1, job O2) {If (o1.t2 <o2.t2) return 1; elsereturn-1 ;}} public class machiningorder {public static void main (string ARGs []) {job jobs [] = {new job (, 7), new job, 2), new job (, 6), new job (, 18), new job (, 3), new job (, 10), new job, 4)}; List <job> J = arrays. aslist (jobs); getsequence (j);} public static void getsequence (list <job> jobs) {list <job> n1 = new arraylist <job> (); list <job> n2 = new arraylist <job> (); For (INT I = 0; I <jobs. size (); I ++) {If (jobs. get (I ). t1 <jobs. get (I ). t2) n1.add (jobs. get (I); elsen2.add (jobs. get (I);} collections. sort (N1); collections. sort (N2, new COM (); system. out. println ("processing sequence"); For (INT I = 0; I <n1.size (); I ++) system. out. print (n1.get (I ). ID); For (INT I = 0; I <n2.size (); I ++) system. out. print (n2.get (I ). ID) ;}}/** processing sequence problem * two machines are working in the pipeline. The product is processed by the first machine and then processed by the second machine, find * Minimum Total time after processing all items * idea: * 1. m1 [I] indicates the time spent on the first machine * m2 [I] indicates the processing time on the second machine * 2. in N1, n1 = {I | m1 [I] <m2 [I]} n2 = {I | m1 [I]> m2 [I]} * 3. sort the parts in N1 by non-subtraction and by non-increment in N2 * 4. set n1n2 as the required sequence **/