Here you can find the source of fill(ByteBuffer buffer, int off, int len, byte val)
public static void fill(ByteBuffer buffer, int off, int len, byte val)
//package com.java2s; import java.nio.ByteBuffer; public class Main { public static void fill(ByteBuffer buffer, int off, int len, byte val) { buffer.position(off);/*from w ww . ja v a 2 s .c o m*/ while (--len >= 0) buffer.put(val); } }