//$GPGGA,092725.00,4717.11399,N,00833.91590,E,1,08,1.01,499.6,M,48.0,M,,*5B
String str="GPGGA,092725.00,4717.11399,N,00833.91590,E,1,08,1.01,499.6,M,48.0,M,,";
char ch=str.charAt(0);
int x=(int)ch;
int y;
for(int i=1;i<str.length();i++){
y=(int)str.charAt(i);
x=x^y;
}
//转换成十六进制形式
String check=Integer.toHexString(x);
System.out.println("check=="+check);//5b
![](https://i-blog.csdnimg.cn/blog_migrate/ff28c42cf1f9310f0023a1ea49d6ec6a.png)