Here you can find the source of getRandomByteArrays(int arrSize)
public static byte[] getRandomByteArrays(int arrSize)
//package com.java2s; import java.util.Random; import android.util.Log; public class Main { public static byte[] getRandomByteArrays(int arrSize) { byte[] byteArr = new byte[arrSize]; for (int i = 0; i < arrSize; i++) { byteArr[i] = getRandomByte(); }/* ww w . ja va 2 s .c o m*/ return byteArr; } public static byte getRandomByte() { byte randomNum = 0; Random random = new Random(); int num = Math.abs(random.nextInt() % 256); randomNum = (byte) num; Log.d("", "--> getRandomNum num : " + num + " , randomNum : " + (randomNum & 0xFF)); return randomNum; } }