Here you can find the source of generateRandomByteArray(int size)
public static byte[] generateRandomByteArray(int size)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static byte[] generateRandomByteArray(int size) { return getRandomByteArray(size); }//from w w w . j a v a 2s . co m private static byte[] getRandomByteArray(int size) { byte[] result = new byte[size]; Random random = new Random(); random.nextBytes(result); return result; } }