iterating a for loop
<p>Android 2.3.3
The problem is pretty simple. The loop is iterating 12 times, where as it should iterate 11 times as for my logic. Can someone spot the problem please... What am i overlooking?</p>

<pre><code>c = db.getData();

if(c.getCount() &gt; 0)
{
    c.moveToFirst();
    System.out.println("Cursor Values are ::: "+c.toString());
    int columCount = c.getColumnCount();
    System.out.println("Column Count is ::: "+columCount);
    boolean isFound = false;


    do
    {
         for(int iteCount = 0; i &lt; columCount; iteCount++)
        {
            System.out.println("Loop ::: "+iteCount);
            String tempString =  c.getString(iteCount);
            System.out.println("Item in TempString is :::"+tempString);

            if(tempString != null &amp;&amp; tempString.equalsIgnoreCase(tempCommand))
            {
                    alFirstIndex.remove(0);
                System.out.println(c.getString(c.getColumnIndex("Command")));
               alFirstIndex.add(0, c.getString(c.getColumnIndex("Command")));
                isFound = true;
                break;
            }
        }
        System.out.println("Out of For Loop");

        if(isFound)
        {
           break;
        }

    }while(c.moveToNext());
</code></pre>

<p>Here is the output from logcat ::::</p>

<pre><code>    12-22 09:13:08.219: I/System.out(25300): Column Count is ::: 11
12-22 09:13:08.219: I/System.out(25300): Loop ::: 0
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::ADD
12-22 09:13:08.219: I/System.out(25300): Loop ::: 1
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::add
12-22 09:13:08.219: I/System.out(25300): Loop ::: 2
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::and
12-22 09:13:08.219: I/System.out(25300): Loop ::: 3
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::had
12-22 09:13:08.219: I/System.out(25300): Loop ::: 4
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::ad
12-22 09:13:08.219: I/System.out(25300): Loop ::: 5
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::anddd
12-22 09:13:08.219: I/System.out(25300): Loop ::: 6
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::anndd
12-22 09:13:08.219: I/System.out(25300): Loop ::: 7
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::null
12-22 09:13:08.219: I/System.out(25300): Loop ::: 8
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::null
12-22 09:13:08.219: I/System.out(25300): Loop ::: 9
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::null
12-22 09:13:08.219: I/System.out(25300): Loop ::: 10
12-22 09:13:08.219: I/System.out(25300): Item in TempString is :::null
12-22 09:13:08.219: I/System.out(25300): Loop ::: 11
12-22 09:13:08.219: E/CursorWindow(25300): Bad request for field slot 0,11. numRows = 18, numColumns = 11
</code></pre>

<p>columnCount = 11, Loop starts with i = 0 and should iterate to i &lt; columCount which means it should iterate 11 times, but why is it entering the FOR loop again and printing Loop ::: 11</p>
