Problem: I need to calculate a CRC16 for hex codes like this one: 08010000016B40D8EA30010000000000000000000000000000000105021503010101425E0F01F10000601A014E000000000000000001 For this, I have a working solution in JavaScript. Due to new requirements, I have to translate this code into Java. Expected result: For above hex string: 0000C7CF ( 51151 ). My approach: I have the following, working JavaScript code, which I am trying to translate