code: public static int generate(int crc, byte []buffer, int offset, int len)
    {
      for (int i = 0; i < len; i++) {
        crc = next(crc, buffer[offset + i]);
      }
  
      return crc;
    }
docs: Calculates CRC from a char buffer