Java Adler32 calculate checksum

Description

Java Adler32 calculate checksum

import java.util.zip.Adler32;

public class Main {
  public static void main(String[] args) throws Exception {
    String str = "demo2s.com";
    byte[] data = str.getBytes("UTF-8");

    // Compute Adler32 checksum
    Adler32 ad = new Adler32();
    ad.update(data);//  w ww.java  2 s.co m
    long adler32Checksum = ad.getValue();
    System.out.println("Adler32: " + adler32Checksum);

  }
}



PreviousNext

Related