Moving up and down file path using nio in java

   subDirPath  = FileSystems.getDefault().getPath(".","files","..","files","SubDirectoryFile.txt");
   System.out.println("The normalised path is ----->"+subDirPath.normalize().toAbsolutePath());
   printFile(subDirPath.normalize());

Helper method to print contents of file

  public static void printFile(Path path){
        try(BufferedReader fileReader = Files.newBufferedReader(path)){
            String line;
            while((line=fileReader.readLine())!=null){
                System.out.println(line);
            }

        } catch (IOException e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
}