import java.util.*; public class CompareString implements Comparator { public int compare(Object o1, Object o2) { String obj1 = (String)o1; String obj2 = (String)o2; StringTokenizer str1 = new StringTokenizer(obj1,"A",false); StringTokenizer str2 = new StringTokenizer(obj2,"A",false); int x1 = Integer.parseInt(str1.nextToken()); int y1 = Integer.parseInt(str1.nextToken()); int z1= Integer.parseInt(str1.nextToken()); int x2 = Integer.parseInt(str2.nextToken()); int y2 = Integer.parseInt(str2.nextToken()); int z2= Integer.parseInt(str2.nextToken()); if (x1==x2)// if priorities of both messages is the same { if (y1==y2)//if message_ids are the same { if(z1==z2) // if message sources are the same { return 0; } else { if(z1