@@ -0,0 +1,1808 @@
+/* Copyright (c) 2011, Avian Contributors%0A%0A   Permission to use, copy, modify, and/or distribute this software%0A   for any purpose with or without fee is hereby granted, provided%0A   that the above copyright notice and this permission notice appear%0A   in all copies.%0A%0A   There is NO WARRANTY for this software.  See license.txt for%0A   details. */%0A%0Apackage java.util.zip;%0A%0Apublic class CRC32 %7B%0A  private static final int Polynomial = 0x04C11DB7;%0A  private static final int Width = 32;%0A  private static final int Top = 1 %3C%3C (Width - 1);%0A  private static final int InitialRemainder = 0xFFFFFFFF;%0A  private static final int ResultXor = 0xFFFFFFFF;%0A%0A  private static final int%5B%5D table = new int%5B256%5D;%0A%0A  static %7B%0A    for (int dividend = 0; dividend %3C 256; ++ dividend) %7B%0A      int remainder = dividend %3C%3C (Width - 8);%0A      for (int bit = 8; bit %3E 0; --bit) %7B%0A        remainder = ((remainder & Top) != 0)%0A          ? (remainder %3C%3C 1) %5E Polynomial%0A          : (remainder %3C%3C 1);%0A      %7D%0A      table%5Bdividend%5D = remainder;%0A    %7D%0A  %7D%0A%0A  private int remainder = InitialRemainder;%0A%0A  public void reset() %7B%0A    remainder = InitialRemainder;%0A  %7D%0A%0A  public void update(int b) %7B%0A    remainder = table%5Breflect(b, 8) %5E (remainder %3E%3E%3E (Width - 8))%5D%0A      %5E (remainder %3C%3C 8);%0A  %7D%0A%0A  public void update(byte%5B%5D array, int offset, int length) %7B%0A    for (int i = 0; i %3C length; ++i) %7B%0A      update(array%5Boffset + i%5D & 0xFF);%0A    %7D%0A  %7D%0A%0A  public void update(byte%5B%5D array) %7B%0A    update(array, 0, array.length);%0A  %7D%0A%0A  public long getValue() %7B%0A    return reflect(remainder, Width) %5E ResultXor;%0A  %7D%0A%0A  private static int reflect(int x, int n) %7B%0A    int reflection = 0;%0A    for (int i = 0; i %3C n; ++i) %7B%0A      if ((x & 1) != 0) %7B%0A        reflection %7C= (1 %3C%3C ((n - 1) - i));%0A      %7D%0A      x = (x %3E%3E%3E 1);%0A    %7D%0A    return reflection;%0A  %7D%0A%7D%0A

implement java.util.zip.CRC32