byte[] readenCrc = new byte[2];
bytes.position(totalLen-2);
bytes.get(readenCrc, 0, 2);
byte[] calculatedCrc = calculateCrc(bytes.array(), totalLen-2);
if(readenCrc[0]!=calculatedCrc[0] || readenCrc[1]!=calculatedCrc[1]){
throw new InvalidPacketException();
}
} catch(Exception e){
throw new InvalidPacketException();
}
}