This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static List<File> findAllFiles(String baseDirectory) { | |
List<File> files = new LinkedList<File>(); | |
List<File> directories = new LinkedList<File>(); | |
directories.add(new File(baseDirectory)); | |
while (!directories.isEmpty()) { | |
File [] subFiles = directories.remove(0).listFiles(); | |
for (File f : subFiles) { | |
if (f.isDirectory()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private long calculateHash(File file) throws FileNotFoundException, IOException { | |
byte[] firstBytes = new byte[7]; | |
byte[] middleBytes = new byte[7]; | |
byte[] lastBytes = new byte[7]; | |
RandomAccessFile raf = new RandomAccessFile(file, "r"); | |
long len = raf.length(); | |
raf.read(firstBytes); | |
raf.seek(len / 2); | |
raf.read(middleBytes); |