public static boolean hasExtension ( File file , String ... extensions ) { String extension = FilenameUtils . getExtension ( file . getName ( ) ) ; for ( String s : extensions ) { if ( extension . equalsIgnoreCase ( s ) || ( "." + extension ) . equalsIgnoreCase ( s ) ) { return true ; } } return false ; }
Checks whether the given file has one of the given extension .