java.util.zip. CRC32.update() 方法示例


java.util.zip. CRC32.update() 方法示例

package com.codingdict;

import java.util.zip.CRC32;

public class CRC32Demo {

   public static void main(String[] args) {
      String message = "Welcome to codingdict.com";
      byte bytes[] = message.getBytes();

      CRC32 checksum = new CRC32();
      checksum.reset();       

      checksum.update(bytes);
      long checksumValue = checksum.getValue();

      System.out.println("CRC32 checksum :" + checksumValue);
   }
}