code: public static String normalizePath(String path) {
          requireNonNull(path, "path");
          if (path.isEmpty()) {
              return "/";
          }
  
          if (!path.startsWith("/")) {
              path = '/' + path;
          }
  
          if (!path.endsWith("/")) {
              path += '/';
          }
  
          return path.replaceAll("//+", "/");
      }
docs: Normalizes the specified {@code path}. A path which starts and ends with {@code /} would be returned.
  Also, it would not have consecutive {@code /}.