Jixi asked "Or should I use something else to store the data?"
Yes you should. I recommend that you create a new class that stores all three things:
public class TimedEvent implements Comparable<TimedEvent> {
String title;
int time1, time2;
public TimedEvent(String name, int t1, int t2) {
title = name;
time1= t1;
time2=t2;
}
public int compareTo(TimedEvent otherEvent) {
return title.compareTo(otherEvent.title);
}
}
Now Arrays.sort will work for you:
TimedEvent[] eventArray = new TimedEvent[5000];
// lots of events get stored.
eventArray[0] = new TimeEvent("Start", 125,134);
eventArray[1] = new TimeEvent("FireClose", 128,139);
eventArray[2] = new TimeEvent("Important Action", 1328,1339);
Arrays.sort(eventArray)
Note that any element of the array that you do not initialize will be null and this will throw an exception when you try to sort. So make sure that the length of the array is exactly what you need. If you don't know how many events you will be storing beforehand, then use an ArrayList instead:
ArrayList<TimedEvent> eventList = new ArrayList<>(); //java7 syntax. use
// new ArrayList<TimedEvent>(); if using Java 6.
// lots of events get stored.
eventList.add(new TimeEvent("Start", 125,134));
eventList.add(new TimeEvent("FireClose", 128,139));
eventList.add(new TimeEvent("Important Action", 1328,1339));
Collections.sort(eventList);