// generate an 32-bit Adler checksum/digest
import java.io.UnsupportedEncodingException;
import java.util.zip.Adler32;

public class Adler
   {
   /**
   * test Adler digest
   * @param args not used
   */
   public static void main ( String[] args ) throws UnsupportedEncodingException
      {
      byte[] theTextToDigestAsBytes = "The quick brown fox jumped over the lazy dog's back".getBytes( "8859_1" /* encoding */ );
      Adler32 digester = new Adler32();
      digester.update( theTextToDigestAsBytes );
      // digester.update( int ) is ambiguously documented. Avoid it or experiment to be sure what it does.
      // getValue produces a long to conform to the Checksum interface.
      // Actual result is 32 bits long not 64!
      int digest = (int) digester.getValue();
      System.out.println( Integer.toHexString( digest ) );
      }
   }