I wrote a checksum calculation function in android/java. the function as follows
void CalculateCheckSum( byte[] bytes ){
short CheckSum = 0, i = 0;
for( i = 0; i < bytes.length; i++ ){
CheckSum = (short) ((short)CheckSum + (short)bytes[i]);
}
Log.i("Checksum", Integer.toHexString(CheckSum));
}
input values for calculation of checksum are 0xEF, 0x01, 0xEF, 0x01, 0x33, 0x0C, 0xB8, 0xE5, 0xFC, 0x34, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF. I manually calculated the checksum value and result is 0xCE4. When using the above function i get answer as 0xFFFFFFE4. Is any error in my calculation, if yes then please correct me.
thanks