public static boolean isExtension(String filename,String[] extensions){
  if (filename == null) {
    return false;
  }
  if (extensions == null || extensions.length == 0) {
    return indexOfExtension(filename) == -1;
  }
  String fileExt=getExtension(filename);
  for (  String extension : extensions) {
    if (fileExt.equals(extension)) {
      return true;
    }
  }
  return false;
}

public static boolean isExtension ( String filename , String [ ] extensions ) { if ( filename == null ) { return false ; } if ( extensions == null || extensions . length == 0 ) { return indexOfExtension ( filename ) == - 1 ; } String fileExt = getExtension ( filename ) ; for ( String extension : extensions ) { if ( fileExt . equals ( extension ) ) { return true ; } } return false ; }
checks whether the extension of the filename is one of those specified . < p > this method obtains the extension as the textual part of the filename after the last dot . there must be no directory separator after the dot . the extension check is case - sensitive on all platforms .
