How do I calculate the checksum of a byte array?

John Zukowski

The Adler32 class in the package can be used to calculate the sum:

byte buffer[] = ...
ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
CheckedInputStream cis = new CheckedInputStream(bais, new Adler32());
byte readBuffer[] = new byte[128];
while ( >= 0);
long value = cis.getChecksum().getValue();
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact