Not getting the reverse list
<p>I'm parsing the json object taken from server. I want to put the list in reverse order. In order to do that I made a code like this.</p>

<pre><code>ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();

        // Creating JSON Parser instance
        JSONParser jParser = new JSONParser();

        // getting JSON string from URL
        JSONObject json = jParser.getJSONFromUrl(url);

        try {
            // Getting Array of Contacts
            products = json.getJSONArray(TAG_PRODUCTS);
            // looping through All Contacts
            for(int i = products.length(); i &gt;0; i--){
                JSONObject c = products.getJSONObject(i);

                // Storing each json item in variable
                String cid = c.getString(TAG_CID);
                String name = c.getString(TAG_NAME);

                // creating new HashMap
                HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();

                // adding each child node to HashMap key =&gt; value
                map.put(TAG_CID, cid);
                map.put(TAG_NAME, name);

                // adding HashList to ArrayList
                contactList.add(map);
                Log.d("value", contactList.toString());
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }


        /**
         * Updating parsed JSON data into ListView
         * */
        ListAdapter adapter = new SimpleAdapter(this, contactList,
                R.layout.list_item,
                new String[] { TAG_NAME,}, new int[] {
                        R.id.name});

        setListAdapter(adapter);
</code></pre>

<p>If I try to do it in the right order, the list will appear. But if I try reverse, I won't get any output. The problem is in for looping. But cannot findout where it is actually.</p>
