public static List<File> getFileList(String loc, String fileEnd)
    {
        if (fileEnd == null)
        {
            fileEnd = "";
        }
        if (loc == null)
        {
            loc = dir;
        }
        // Directory path here
        String file;
        File folder = new File(loc);
        File[] listOfFiles = folder.listFiles();
        List<File> files = new ArrayList<File>();
        if (listOfFiles != null)
        {
            for (int i = 0; i < listOfFiles.length; i++)
            {

                if (listOfFiles[i].isFile())
                {
                    file = listOfFiles[i].getName();
                    if (file.endsWith(fileEnd) || fileEnd == "")
                    {
                        files.add(listOfFiles[i]);
                    }
                }
            }
        }
        return files;
    }