Java CRC32 Byte Array crc32(byte[] bytes)

Here you can find the source of crc32(byte[] bytes)

Description

Compute the CRC32 of the byte array

License

Open Source License

Parameter

Parameter Description
bytes The array to compute the checksum for

Return

The CRC32

Declaration

public static long crc32(byte[] bytes) 

Method Source Code

//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();
    }
}

Related

  1. computeCRC(byte[] value)
  2. computeCRC32(byte[] bytes)
  3. crc32(byte[] array)
  4. crc32(byte[] bts)
  5. CRC32(byte[] buffer)
  6. crc32(byte[] bytes)
  7. crc32(final byte[] bytes)
  8. crc32(String value)
  9. crc32Number(String s)