Java tutorial
//package com.java2s; // Licensed under the MIT License: import java.nio.ByteBuffer; public class Main { static void memset(ByteBuffer dstBuffer, int dstByteOffset, byte value, int length) { // TODO we can probably do this faster for (int ii = dstByteOffset; ii < dstByteOffset + length; ++ii) { dstBuffer.put(ii, value); } } }