private boolean isSameFile(Path first,Path second) throws IOException {
  boolean sameFileSize=Files.size(first) == Files.size(second);
  if (!sameFileSize) {
    return false;
  }
  byte[] firstBytes=Files.readAllBytes(first);
  byte[] secondBytes=Files.readAllBytes(second);
  return Arrays.equals(firstBytes,secondBytes);
}

private boolean isSameFile ( Path first , Path second ) throws IOException { boolean sameFileSize = Files . size ( first ) == Files . size ( second ) ; if ( ! sameFileSize ) { return false ; } byte [ ] firstBytes = Files . readAllBytes ( first ) ; byte [ ] secondBytes = Files . readAllBytes ( second ) ; return Arrays . equals ( firstBytes , secondBytes ) ; }
compares the content of two paths by comparing them
