private static void updateFlights()
    {
        int i;
        Date lastFlightDate = new Date();  
        Date nextFlightDate = new Date(System.currentTimeMillis()+ 24*60*60*1000);

        ArrayList<Flight> newFlightList = new ArrayList();
        
        for(Flight flight:flightList)
        {           
            if (flight.getDepartureDate().after(nextFlightDate))
                newFlightList.add(flight);
            lastFlightDate = flight.getDepartureDate();
        }
        flightList.clear();
        flightList = (ArrayList<Flight>) newFlightList.clone();
                
        i =0;

        Calendar cal = Calendar.getInstance();  

        while (flightList.size() < MAX_NUMBER_FLIGHTS)
        {
            i++;
            cal.setTime(lastFlightDate);  
            cal.add(Calendar.DAY_OF_YEAR, i); 
            Date date = cal.getTime();  
            Flight newFlight1 = new Flight("SJC", "LAS" , date);
            flightList.add(newFlight1);
            Flight newFlight2 = new Flight("LAS", "SJC" , date);
            flightList.add(newFlight2);
        }
    }