Here you can find the source of putWithChecksum(ByteBuffer buffer, int value, Adler32 checksum)
static void putWithChecksum(ByteBuffer buffer, int value, Adler32 checksum)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; import java.util.zip.Adler32; public class Main { static void putWithChecksum(ByteBuffer buffer, int value, Adler32 checksum) { buffer.putInt(value);//from ww w . j a v a 2s.c o m checksum.update(value); } static void putWithChecksum(ByteBuffer buffer, long value, Adler32 checksum) { buffer.putLong(value); checksum.update((int) (value & 0xFFFFL)); checksum.update((int) (value >> 32)); } }