How to optimize the loop in java
<pre><code>    mydate = new GregorianCalendar(Integer.parseInt(datetext[5].substring(0, 4)), Integer.parseInt(datetext[5].substring(4, 6)),
            Integer.parseInt(datetext[5].substring(6, 8)), starttime, 00, 00);
    enddate = new GregorianCalendar(Integer.parseInt(datetext[5].substring(0, 4)), Integer.parseInt(datetext[5].substring(4, 6)),
            Integer.parseInt(datetext[5].substring(6, 8)), endtime - 1, 59, 00);

    String line = "";
    sdf = new SimpleDateFormat("HH:mm:ss");
    SimpleDateFormat datetimeFormatter1 = new SimpleDateFormat("yyyyMMddHHmmss");
    SimpleDateFormat datetimeFormatter2 = new SimpleDateFormat("yyyyMMddHHmmss");

    try {
        while (mydate.compareTo(enddate) &lt;= 0) {
            BufferedReader reader = new BufferedReader(new FileReader(fileName));
            //line=reader.readLine();

            count = 0;
            while ((line = reader.readLine()) != null) {

                myText = line.split(",");
                Date lFromDate1 = datetimeFormatter1.parse(myText[3]);
                Date lFromDate2 = datetimeFormatter2.parse(myText[13]);

                if (myText[0].equals(combo.getSelectedItem().toString())
                        &amp;&amp; myText[15].equals(combo1.getSelectedItem().toString()) &amp;&amp; (!myText[2].equals("OPERATOR")
                        &amp;&amp; !myText[2].equals("PROXY"))) {

                    try {
                        if (sdf.format(mydate.getTime()).compareTo(sdf.format(lFromDate1)) &gt;= 0) {
                            if (sdf.format(mydate.getTime()).compareTo(sdf.format(lFromDate2)) &lt;= 0) {
                                count += 1;

                            }
                        }
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                }
            }

            cnt = cnt + 1;
            countarray[cnt] = count;
            mydate.add(Calendar.MINUTE, 1);
</code></pre>

<p>how to optimize the above loop. Please help me.</p>
