Calculating the Checksum of a Byte Array public static long checksum(byte[] buf) { try { CheckedInputStream cis = new CheckedInputStream(new ByteArrayInputStream(buf), new Adler32()); byte[] tempBuf = new byte[128]; while (cis.read(tempBuf) >= 0) { } return cis.getChecksum().getValue(); } catch (IOException e) { return -1; } }