Code example for CRC32

Methods: getValueresetupdate

0
	/** 
	 * @tests java.util.zip.CRC32#update(int) 
	 */ 
	public void test_updateI() { 
		// test methods of java.util.zip.crc32.update(int) 
		CRC32 crc = new CRC32();
		crc.update(1);
		// System.out.print("value of crc"+crc.getValue()); 
		// Ran JDK and discovered that the value of the CRC should be 
		// 2768625435 
		assertEquals("update(1) failed to update the checksum to the correct value ",
				2768625435L, crc.getValue());
 
		crc.reset();
		crc.update(Integer.MAX_VALUE);
		// System.out.print("value of crc " + crc.getValue()); 
		// Ran JDK and discovered that the value of the CRC should be 
		// 4278190080 
		assertEquals("update(max) failed to update the checksum to the correct value ",
				4278190080L, crc.getValue());
 
		crc.reset();
		crc.update(Integer.MIN_VALUE);
		// System.out.print("value of crc " + crc.getValue()); 
		// Ran JDK and discovered that the value of the CRC should be 
		// 3523407757 
		assertEquals("update(min) failed to update the checksum to the correct value ",
				3523407757L, crc.getValue());
	} 
 
	/** 
	 * @tests java.util.zip.CRC32#update(byte[]) 
	 */ 
Connect your IDE to all the code out there  Get Codota for Java