code: public static String formatMode(short mode, boolean directory, boolean hasExtended) {
      StringBuilder str = new StringBuilder();
      if (directory) {
        str.append("d");
      } else {
        str.append("-");
      }
      str.append(new Mode(mode).toString());
      if (hasExtended) {
        str.append("+");
      }
      return str.toString();
    }
docs: Formats digital representation of a model as a human-readable string.
  
  @param mode file mode
  @param directory if the mode corresponds to a directory
  @param hasExtended true if extended acls exist
  @return human-readable version of the given mode