Gregorian Calender Auto adds to Month
<p>I am trying to get client entrance and exit date and see if they are valid.
but random days are added to month with each time I run the program. the month can be 43 for example after I entered 03. can you tell me why ? </p>

<pre><code>public void makeNewReservation() throws ParseException {

        // Enter informations
        boolean error=true;
        boolean dateOK=false;
        String date_sortiee="";
        String date_entree="";
        Scanner in=new Scanner(System.in);


        while(error){
            //take date of checkin and checkout and verify if they are OK

            System.out.println("Single room selected ? dd/MM/yyyy");
            System.out.println("Date de Entree?");
            in=new Scanner(System.in);

        //  date_entree = in.next();    

            System.out.println("Date de Entree? dd/MM/yyyy");
            date_entree = in.next();
            String[] test = date_entree.split("/");
            int day = Integer.parseInt(test[0]);
            int Month = Integer.parseInt(test[1]);

            int year = Integer.parseInt(test[2]);
            DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
            GregorianCalendar checkin= new GregorianCalendar();
            checkin.set(year, Month, day);

            System.out.println("Date de Sortie? dd/MM/yyyy");
            date_sortiee = in.next();
            String[] test1 = date_sortiee.split("/");
            int day1 = Integer.parseInt(test[0]);
            int Month1 = Integer.parseInt(test[1]);
            int year1 = Integer.parseInt(test[2]);
            DateFormat format1 = new SimpleDateFormat("dd/MM/yyyy");
            GregorianCalendar checkout= new GregorianCalendar();
            //System.out.println(format.format(checkin));
            checkout.set(year1, Month1, day1);


            checkdate(checkin,checkout);


            dateOK= checkdate(checkin, checkout);
            if (dateOK){
                error=false;
            }
            else{
                error=true;
            }
        }


public boolean checkdate(GregorianCalendar in,GregorianCalendar out){
    DateFormat format = new SimpleDateFormat("dd/mm/yyyy");
    GregorianCalendar today = new GregorianCalendar();
    System.out.println(format.format(in.getTime()));
    boolean test=false;
    if(in.before(out)&amp;&amp;in.after(today)|| in.before(out)&amp;&amp; in.equals(today)){
        System.out.println("puck u");
        test= true;

    }
    return test;
</code></pre>
