private ArrayList < String > getFiles ( String dir , String subDir ) { ArrayList < String > files = new ArrayList <> ( ) ; String fullDir = subDir == null ? dir : dir + File . separator + subDir ; File [ ] listOfFiles = ( new File ( fullDir ) ) . listFiles ( ) ; if ( listOfFiles != null ) { for ( File file : listOfFiles ) { String fullName = subDir == null ? file . getName ( ) : subDir + File . separator + file . getName ( ) ; if ( file . isFile ( ) ) { files . add ( fullName ) ; } else if ( file . isDirectory ( ) ) { files . addAll ( getFiles ( dir , fullName ) ) ; } } } return files ; }
Gets the files .