Code example for SparseArray

import android.view.Surface; 
import android.view.WindowManager; 
final class DisplayManagerCollector { 
    final static SparseArray<String> mFlagsNames = new SparseArray<String>();
    final static SparseArray<String> mDensities = new SparseArray<String>();
    public static String collectDisplays(Context ctx) {
        Display[] displays = null;
        final StringBuilder result = new StringBuilder();
        if (Compatibility.getAPILevel() < 17) { 
            // Before Android 4.2, there was a single display available from the 
            // window manager 
            final WindowManager windowManager = (WindowManager) ctx
            displays = new Display[1];
            displays[0] = windowManager.getDefaultDisplay();
        } else { 
Connect your IDE to all the code out there  Get Codota for Java