Approach1: Group all files by the hashcode of their bytes.
Use a Map<Long, List<Path>>
to represent them.
Here, the key is the hashCode of all the bytes from a File.
The algorithm:
For each file(ancestor) of the folder given
bytes = Files.read(file);
hashCode = Arrays.hashCode(bytes);