public static int getCRC16(byte[] bytes) {
CRC16 crc = new CRC16();
crc.reset();
crc.update(bytes, 0, bytes.length);
return (int) crc.getValue();
}
Tons of threads will hit this method, if I don't synchronize I'll get a wrong crc for a specific thread?
No, it is fine, as long as you don't use any shared variables. The bytesand crcare local per thread. That's why they are called local variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With