Here you can find the source of nextBytes(int length)
public static byte[] nextBytes(int length)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static final Random randomInstance = new Random(); public static byte[] nextBytes(int length) { Random r = getInstance(); byte[] buf = new byte[length]; r.nextBytes(buf);/* w ww . j a v a 2 s . com*/ return buf; } public static Random getInstance() { return randomInstance; } }