code: public static String getExtension(final String filename) {
          Objects.requireNonNull(filename, "filename cannot be null");
          int lastDotIdx = filename.lastIndexOf(".");
          return lastDotIdx >= 0 ? filename.substring(lastDotIdx) : "";
      }
docs: Returns the extension of a file, including the dot.
  
  @param filename the name of a file, may be not be null
  @return the file extension or an empty string if the extension cannot be determined.