Here is the code I wrote, with some help of course. But there is some bugs in the logic part I cant spot. I am pretty new to programming, and i little help wouldn't mind
public class Directories {
 public static void main(String[] args) {
    Path currentDir = Paths.get("/root"); // some directory
    displayDirectoryContents(currentDir);
}
public static void displayDirectoryContents(Path dir) {
    final List<Path> duplicates = new ArrayList<Path>();
    final List<Path> uniqueFiles = new ArrayList<Path>();   
    try {   
        final DirectoryStream<Path> stream = Files.newDirectoryStream(dir);
        for(Path entry : stream){
            if(Files.isDirectory(entry)){
                displayDirectoryContents(entry);
            } else {
                for(final Path alreadySeen : uniqueFiles){
                    if(isDuplicated(entry, alreadySeen)){
                        duplicates.add(entry);
                    } else {
                        uniqueFiles.add(entry);
                    }   
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
private static final boolean isDuplicated(final Path first, final Path second){
    try{
        return Files.size(first) == Files.size(second) && 
                Arrays.equals(Files.readAllBytes(first), Files.readAllBytes(second));
    } catch (IOException e) {
        e.printStackTrace();
    }
    return false;
}
}
I would really appreciate some help. Thank you
 
     
     
    