code: public boolean compareFileExtension(String fileName,
                                          String extension) {
          
          if (fileName == null || extension == null) {
              return false;
          }
          
          fileName = fileName.toLowerCase().trim();
          extension = extension.toLowerCase();
          return (fileName.endsWith(extension));         
      }
docs: Returns true if the specified fileName ends with the specified
  file extension.