Calculate checksums for a range of bytes.


import java.util.zip.Adler32;
import java.util.zip.Checksum;

public class Main {

    public static long compute(byte[] data, int start, int length) {
        Checksum checksum = new Adler32();
        checksum.update(data, start, length);
        return checksum.getValue();
    }

}
Home 
  Java Book 
    Runnable examples  

Security:
  1. Calculate checksums for a range of bytes.
  2. Calculate MD5 for a String
  3. Calculate MD5 for a Stream