同一文件 CRC32 我生成的全部是数字,网上在线生成的怎么是有英文的,是不是我这个有问题
public static String getCRC32(File file) {
CRC32 crc32 = new CRC32();
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(file);
byte[] buffer = new byte[8192];
int length;
while ((length = fileInputStream.read(buffer)) != -1) {
crc32.update(buffer, 0, length);
}
return crc32.getValue() + "";
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
try {
if (fileInputStream != null)
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
撒科打诨
相关分类