code: public String getParent() {
          int length = path.length(), firstInPath = 0;
          if (separatorChar == '\\' && length > 2 && path.charAt(1) == ':') {
              firstInPath = 2;
          }
          int index = path.lastIndexOf(separatorChar);
          if (index == -1 && firstInPath > 0) {
              index = 2;
          }
          if (index == -1 || path.charAt(length - 1) == separatorChar) {
              return null;
          }
          if (path.indexOf(separatorChar) == index
                  && path.charAt(firstInPath) == separatorChar) {
              return path.substring(0, index + 1);
          }
          return path.substring(0, index);
      }
docs: Returns the pathname of the parent of this file. This is the path up to
  but not including the last name. {@code null} is returned if there is no
  parent.
  
  @return this file's parent pathname or {@code null}.