Here you can find the source of generateRandomBytes(int size)
public static byte[] generateRandomBytes(int size)
//package com.java2s; /*//w w w . j av a 2 s. c o m * Copyright (C) Mellanox Technologies Ltd. 2001-2017. ALL RIGHTS RESERVED. * See file LICENSE for terms. */ import java.util.Random; public class Main { public static byte[] generateRandomBytes(int size) { Random rand = new Random(); byte[] arr = new byte[size]; rand.nextBytes(arr); return arr; } }