code: public static String getExtension(final String file) {
          final int index = file.indexOf(SHARP);
  
          if (file.startsWith(SHARP)) {
              return null;
          } else if (index != -1) {
              final String fileName = file.substring(0, index);
              final int fileExtIndex = fileName.lastIndexOf(DOT);
              return fileExtIndex != -1 ? fileName.substring(fileExtIndex + 1) : null;
          } else {
              final int fileExtIndex = file.lastIndexOf(DOT);
              return fileExtIndex != -1 ? file.substring(fileExtIndex + 1) : null;
          }
      }
docs: Get file extension
  
  @param file filename, may contain a URL fragment
  @return file extensions, {@code null} if no extension was found