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 

public class Main {
    private static String getCheckSum(String aString) {
        int checksum = 0;
        String checkedString = aString.substring(1, aString.indexOf("*"));

        for (int i = 0; i < checkedString.length(); i++) {
            checksum = checksum ^ checkedString.charAt(i);
        }

        String hex = Integer.toHexString(checksum);
        if (hex.length() == 1)
            hex = "0" + hex;

        return hex.toUpperCase();
    }
}