tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Commons IO > Basic > File Checksum

File Checksum 

Apache Commons IO is a java library with simple IO utilities and filters. This requires the library commons-io-2.1.jar to be in classpath. The following example shows using FileUtils.checksumCRC32() API. It returns the checksum of given file using CRC32 checksum algorithm.

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]
package com.bethecoder.tutorials.commons_io.tests;



public class FileChecksum {

   @param args
   @throws IOException 
  public static void main(String[] argsthrows IOException {
    File file = new File("C:/Test/rule_engine_names2.txt");
    //Get checksum using CRC32 checksum routine
    long checkSum = FileUtils.checksumCRC32(file);
    System.out.println("File checksum : " + checkSum);

It gives the following output,
File checksum : 1495706579


bl  br