Code example for Checksum

Methods: getValue, reset

0
  } 
 
  /** 
   * Converts a checksum integer value to a byte stream 
   */ 
  static public byte[] convertToByteStream(Checksum sum, int checksumSize) {
    return int2byte((int)sum.getValue(), new byte[checksumSize]);
  } 
 
  static byte[] int2byte(int integer, byte[] bytes) {
    bytes[0] = (byte)((integer >>> 24) & 0xFF);
    bytes[1] = (byte)((integer >>> 16) & 0xFF);
    bytes[2] = (byte)((integer >>>  8) & 0xFF);
    bytes[3] = (byte)((integer >>>  0) & 0xFF);
    return bytes;
  } 
 
  /** 
   * Resets existing buffer with a new one of the specified size. 
   */ 
  protected synchronized void resetChecksumChunk(int size) {