How to sort ArrayList<String> in Java in decreasing order? : <p>I am new in java i am trying to sort a list of install app in device according to their data use. i want like highest at the top.i use code to find install package are:</p>

<pre><code> List&lt;ApplicationItem&gt; mApplicationItemList = new ArrayList&lt;ApplicationItem&gt;();
    PackageManager p = getPackageManager();
    final List&lt;PackageInfo&gt; apps = p.getInstalledPackages(PackageManager.GET_PERMISSIONS);

            for (PackageInfo packageInfo : apps) {
                ApplicationItem item = new ApplicationItem();
                if (packageInfo.requestedPermissions == null)
                    continue;

                if (Arrays.asList(packageInfo.requestedPermissions).contains(android.Manifest.permission.INTERNET) &amp;&amp;
                        !Utility.isSystemApp(packageInfo.packageName) &amp;&amp;
                        (p.getLaunchIntentForPackage(packageInfo.packageName) != null)) {
                    item.setPkgName(packageInfo.packageName);
                    mApplicationItemList.add(item);
                }
            }
   and find data usage by this code:
public static long getTotalDataByUid(String pkgName) {
        long totalData = 0;
        try {
            ApplicationInfo appInfo = getApplicationContext().getPackageManager().getApplicationInfo(pkgName, 0);
            //TODO Handle UNSUPPORTED
            long tx = TrafficStats.getUidTxBytes(appInfo.uid);
            long rx = TrafficStats.getUidRxBytes(appInfo.uid);
            totalData = tx + rx;
            if (totalData &lt; 0) {
                totalData = 0;
            }


        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            totalData = 0;
        }
        return totalData;
    }
</code></pre>
