home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / sun / misc / CRC16.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  523 b   |  26 lines

  1. package sun.misc;
  2.  
  3. public class CRC16 {
  4.    public int value = 0;
  5.  
  6.    public void update(byte var1) {
  7.       int var2 = var1;
  8.  
  9.       for(int var4 = 7; var4 >= 0; --var4) {
  10.          var2 <<= 1;
  11.          int var3 = var2 >>> 8 & 1;
  12.          if ((this.value & 'ΦÇÇ') != 0) {
  13.             this.value = (this.value << 1) + var3 ^ 4129;
  14.          } else {
  15.             this.value = (this.value << 1) + var3;
  16.          }
  17.       }
  18.  
  19.       this.value &= 65535;
  20.    }
  21.  
  22.    public void reset() {
  23.       this.value = 0;
  24.    }
  25. }
  26.