Generate CRC32 Checksum For Byte Array - Java Security

Java examples for Security:CRC

Description

Generate CRC32 Checksum For Byte Array

Demo Code

 
import java.util.zip.CRC32;
import java.util.zip.Checksum;
 
public class Main {
        public static void main(String args[]){
                String str = "Generate CRC32 Checksum For Byte Array Example";
                byte bytes[] = str.getBytes();
                Checksum checksum = new CRC32();
                checksum.update(bytes,0,bytes.length);
                long lngChecksum = checksum.getValue();
                System.out.println("CRC32 checksum for byte array is :" + lngChecksum);
        }//from  www. jav a  2  s  . c  om
}

Result


Related Tutorials