code: public static String getFilenameExtension(String name) {
      if(name == null) {
        return null;
      }
      int index = name.lastIndexOf('.');
      return index < 0 ? null : name.substring(index + 1).toLowerCase();
    }
docs: Returns the lower case extension of the selected file.
  
  If no file is selected, <code>null</code> is returned.
  
  @param name File name
  @return Returns the extension of the selected file in lower case or
  <code>null</code>