Here you can find the source of crc32(byte[] bytes)
Parameter | Description |
---|---|
bytes | The array to compute the checksum for |
public static long crc32(byte[] bytes)
//package com.java2s; //License from project: Open Source License import java.util.zip.CRC32; public class Main { /**/* www . jav a 2 s . c o m*/ * Compute the CRC32 of the byte array * * @param bytes The array to compute the checksum for * @return The CRC32 */ public static long crc32(byte[] bytes) { return crc32(bytes, 0, bytes.length); } /** * Compute the CRC32 of the segment of the byte array given by the * specificed size and offset * * @param bytes The bytes to checksum * @return The CRC32 */ public static long crc32(byte[] bytes, int offset, int size) { CRC32 crc = new CRC32(); crc.update(bytes, offset, size); return crc.getValue(); } }