Here you can find the source of checksum(String nmea)
public static boolean checksum(String nmea)
//package com.java2s; //License from project: LGPL public class Main { public static boolean checksum(String nmea) { int len = nmea.length(); if (len < 3) return false; try {//w w w.j av a 2 s . c o m String checksumString = nmea.substring(len - 2, len); int target = Integer.valueOf(checksumString, 16); int chk = computeChecksum(nmea); if (chk == target) return true; } catch (NumberFormatException e) { // System.out.println(e); e.printStackTrace(); } return false; } public static int computeChecksum(String nmea) { char chk = 0; for (int i = 1; i < nmea.length(); i++) { char c = nmea.charAt(i); if (c == 0 || c == '*') break; chk ^= c; } return chk; } }