Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static int nmeaChecksum(CharSequence nmea, int startIndex) { int length = nmea.length(); return nmeaChecksum(nmea, startIndex, length); } public static int nmeaChecksum(CharSequence nmea, int startIndex, int endIndex) { int checkSum = 0; for (int c = startIndex; c < endIndex; c++) { checkSum ^= (int) nmea.charAt(c); } return checkSum; } }