Here you can find the source of calcCRC(int crc, byte[] bytes, int start, int len)
public static int calcCRC(int crc, byte[] bytes, int start, int len)
//package com.java2s; public class Main { private static int[] _cache; public static int calcCRC(int crc, byte[] bytes, int start, int len) { initCRCCache();//from w w w . j a v a 2s.c o m for (int j = 0; j < len; ++j) { final byte b = bytes[j + start]; crc = calcCRC(crc, b); } return crc; } public static int calcCRC(int crc, byte b) { int index = crc >>> 24; index ^= ((int) b) & 0xff; crc <<= 8; crc ^= _cache[index]; return crc; } private static void initCRCCache() { if (_cache != null) return; _cache = new int[256]; for (int j = 0; j < 256; ++j) { int value = j << 24; for (int bit = 0; bit < 8; ++bit) { if ((value & 0x80000000) == 0x80000000) { // bit31 is set value <<= 1; value ^= 0xAF; } else { value <<= 1; } } value &= 0xffff; _cache[j] = value; } } }