The java.util.zip package can be used to create a checksum.
import java.io.BufferedInputStream; import java.io.FileInputStream; import java.util.Arrays; import java.util.zip.CRC32; public class Main { public static void main(String[] args) throws Exception{ BufferedInputStream is = new BufferedInputStream(new FileInputStream("a.exe")); byte[] bytes = new byte[1024]; int len = 0; while ((len = is.read(bytes)) >= 0) { new CRC32().update(bytes, 0, len); } is.close(); System.out.println(Arrays.toString(bytes)); } }