Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.util.Random; public class Main { private static ByteBuffer buffer(int len) { byte[] b = new byte[len]; Random r = new Random(); r.nextBytes(b); return ByteBuffer.wrap(b); } }