@Test public void testCalculate() throws Exception { byte[] buf = new byte[] { 0x00, 0x64, 0x01, 0x31, 0x31, (byte) 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x28, 0x23, 0x79, 0x65, 0x61, 0x72, 0x30, 0x5E, 0x30, 0x23, 0x29, 0x28, 0x40, 0x31, 0x40, 0x29, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00 }; assertTrue(Crc32Utils.calculate(buf) == crc32(buf)); BENCHMARK.doSomething("Noark-CRC32:", () -> Crc32Utils.calculate(buf)); BENCHMARK.doSomething("JDK-CRC32:", () -> crc32(buf)); }
public static int calculate(byte[] array) { int crc = 0xffffffff; for (byte b : array) { crc = crc >>> 8 ^ TABLE[(crc ^ b) & 0xff]; } return crc ^ 0xffffffff; }
Crc32Utils { public static int calculate(byte[] array) { int crc = 0xffffffff; for (byte b : array) { crc = crc >>> 8 ^ TABLE[(crc ^ b) & 0xff]; } return crc ^ 0xffffffff; } }
Crc32Utils { public static int calculate(byte[] array) { int crc = 0xffffffff; for (byte b : array) { crc = crc >>> 8 ^ TABLE[(crc ^ b) & 0xff]; } return crc ^ 0xffffffff; }  }
Crc32Utils { public static int calculate(byte[] array) { int crc = 0xffffffff; for (byte b : array) { crc = crc >>> 8 ^ TABLE[(crc ^ b) & 0xff]; } return crc ^ 0xffffffff; }  static int calculate(byte[] array); }
Crc32Utils { public static int calculate(byte[] array) { int crc = 0xffffffff; for (byte b : array) { crc = crc >>> 8 ^ TABLE[(crc ^ b) & 0xff]; } return crc ^ 0xffffffff; }  static int calculate(byte[] array);  }