I am giving a time interval in the form of a input file .

```
INPUT FILE
2 3   //First  start time and second one end time
5 6
9 11
3 10

```

I want to sort the interval on the basics of start time i.e.

```
(2,3) , (3,10) ,(5,6) ,(9,11)

```

Does i have to make a structure of this. or it can be done straight.
My approach:

```
class Interval implements Comparable<Interval>{

        private int start , end;
        public Interval(int start , int end){
            this.start = start;
            this.end = end;
        }
        public int compareTo(Interval o) {
            // TODO Auto-generated method stub
            if(o==null)
                return -1;
            return  start-o.start;
        }

    }

```

I am not getting the output of it.  
**Is there any better method**
Please HElp me.