Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.UnsupportedEncodingException;

import java.util.zip.CRC32;
import java.util.zip.Checksum;

public class Main {
    public static long doChecksum(String text) throws UnsupportedEncodingException {
        byte bytes[] = text.getBytes("UTF-8"); // This makes this hash function platform independent
        Checksum checksum = new CRC32();
        checksum.update(bytes, 0, bytes.length);
        long lngChecksum = checksum.getValue();
        return lngChecksum;
    }
}