public byte calcChecksum(String data) { int checksum = 0; for (int i=0; i < data.length(); i++) { checksum = (checksum + data.charAt(i)) % 256; } return (byte)(checksum & 0xff);
protected String calcChecksum(String parCadena) { long sum = 0L; StringCharacterIterator ci = new StringCharacterIterator(parCadena); for (char c = ci.last(); c != '\uffff'; c = ci.previous()) sum += (long) c; String binSum = Long.toBinaryString(sum); StringBuffer sb = new StringBuffer(); sb.append(Integer.toHexString(Integer.valueOf (binSum.substring((binSum.length() - 8), (binSum.length() - 4)), 2) .intValue())); sb.append(Integer.toHexString(Integer.valueOf (binSum.substring((binSum.length() - 4), binSum.length()), 2) .intValue())); return sb.toString().toUpperCase();
    public byte calcChecksum(String data)    {        int checksum = 0;        for (int i=0; i < data.length(); i++)        {            checksum = (checksum + data.charAt(i)) % 256;        }        return (byte)(checksum & 0xff);    }