Sample code for 30+ languages & platforms
Java

Compute CRC32 of a File

Calculates the CRC32 of a file's contents and returns the 32-bit CRC as a hex string.

Chilkat Java Downloads

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    CkZipCrc zipCrc = new CkZipCrc();
    // Use a relative for absolute path to the file..
    int crc = zipCrc.FileCrc("qa_data/hamlet.xml");
    String hexStr = zipCrc.toHex(crc);
    System.out.println(hexStr);
  }
}