code: public static boolean needsNormalization(String path) {
      int last = path.length() - 1;
      int curr = 0;
  
      // Skip initial slashes
      while (curr <= last) {
        if (path.charAt(curr) != '/') {
          break;
        }
        curr++;
      }
      if (curr > 1) {
        return true;
      }
  
      while (curr <= last) {
        // segment is "." or "./"
        if ((path.charAt(curr) == '.') && ((curr == last) || (path.charAt(curr + 1) == '/'))) {
          return true;
        }
        // segment is ".." or "../"
        if ((path.charAt(curr) == '.') && (path.charAt(curr + 1) == '.') && ((curr + 1 == last) || (
            path.charAt(curr + 2) == '/'))) {
          return true;
        }
        while (curr <= last) {
          // Find next '/'
          if (path.charAt(curr++) != '/') {
            continue;
          }
          // Previous 'curr' was a '/'. Check for redundant slashes.
          if (path.charAt(curr) != '/') {
            break;
          }
          // multiple slashes
          return true;
        }
      }
      return false;
    }
docs: Returns true if the path requires normalization. A path needs normalization if it has segments
  of: ".", "..", or consecutive "/".
  @param path path to check
  @return true if the path requires normalization