Csv file Loop works wrong
<p>I am trying to write the test result in csv file by using BufferedWriter. The test duration for WAF5-H is 2 seconds. and WAF6-L is 5 seconds. 
My output file is:</p>

<pre><code>Thu Feb 18 14:01:07 CET 2016;0;WAF5-H;
WAF5-H;
Thu Feb 18 14:01:08 CET 2016;0;WAF5-H;
WAF5-H;
Thu Feb 18 14:01:09 CET 2016;0;WAF5-H;
WAF5-H;
</code></pre>

<p>I expected:</p>

<pre><code>Thu Feb 18 14:01:07 CET 2016;0;WAF5-H;
Thu Feb 18 14:01:08 CET 2016;1;WAF5-H;
Thu Feb 18 14:01:08 CET 2016;2;WAF5-H;
</code></pre>

<p>until test end then the next job will begin.</p>

<pre><code>for (int i = 0; i &lt; convertedDifference; i++) {
    for (Job currentJob : NEHCalculator.addNewJobInitializeList()) {
        int testDevice = (DeviceGroups.DeviceAList.size() + DeviceGroups.DeviceBList.size()
            + DeviceGroups.DeviceCList.size() + DeviceGroups.DeviceDList.size());
        int times = (int) ((convertedDifference / currentJob.getInterval()) * testDevice);
        for (int t = 0; t &lt; times; t++) {
            // until end of the test date.
            cal.add(Calendar.SECOND, 1);
            beginDate.getTime();
            // write the test date
            bufferedWriter.write(String.valueOf(cal.getTime()));
            bufferedWriter.write(';');
            // write the test total second begin with 0.
            bufferedWriter.write(String.valueOf(i));
            bufferedWriter.write(';');
            double j = 0;

            for (j = 0; j &lt; currentJob.getNeededTestTime(); j++) {
                bufferedWriter.write(currentJob.getJobname());
                bufferedWriter.write(';');
                bufferedWriter.newLine();
            }
        }
        i++;
    }
}

bufferedWriter.close();// Always close files.
</code></pre>

<p>The first for loop explain do the test until test ending time. (
   actual output violated this because it write down 0 2 times so it
   will continue until 13442.. . Normally I expected to see 3600 lines
   in my csv file.</p>

<p>The second for each loop get the selected job list.</p>

<p>Third for loop explains how many time testing will be occured. ( I
   entered 1 hour testing time and testing time will make every 15
   minutes and WAF 5H tests 4 devices. So 4*4*2 = 32 times I would like
   to see WAF5-H on the csv file. </p>

<p>Last for loop explains the needed time
   testing for each required machine. ( For WAF 5-H 2 seconds.)</p>

<p>Could someone please help me</p>