Here you can find the source of getRandomBytes(final int size)
static byte[] getRandomBytes(final int size)
//package com.java2s; import java.security.SecureRandom; public class Main { static byte[] getRandomBytes(final int size) { final SecureRandom random = new SecureRandom(); final byte[] bytes = new byte[size]; random.nextBytes(bytes);/*from ww w. j av a 2 s. c om*/ return bytes; } }