java.util.zip.Adler32.reset() Method Example



Description

The java.util.zip.Adler32.reset() method resets the checksum to initial value.

Declaration

Following is the declaration for java.util.zip.Adler32.reset() method.

public void reset()

Returns

the current checksum value.

Example

The following example shows the usage of java.util.zip.Adler32.reset() method.

package com.tutorialspoint;

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

public class Adler32Demo {

   public static void main(String[] args) {
      String message = "Welcome to Tutorialspoint.com";
      byte bytes[] = message.getBytes();
      Checksum checksum = new Adler32();
      checksum.reset();       
      checksum.update(bytes,0,bytes.length);
      long checksumValue = checksum.getValue();
      System.out.println("Adler32 checksum :" + checksumValue);
   }
}

Let us compile and run the above program, this will produce the following result −

Adler32 checksum :2799700814
Print
javazip_adler32.htm
Advertisements