public static int checksum(ByteBuffer data, int offset, int length) {
		data.order(ByteOrder.LITTLE_ENDIAN);
		short sum = 0;
		for (int i = offset; i < offset + length; i += 2) {
			sum += data.getShort(i);
		}
		return ((~sum + 1) & 0xffff);
	}