Here you can find the source of generateRandomIntObj(int range, int noOfElements)
public static Integer[] generateRandomIntObj(int range, int noOfElements)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static Integer[] generateRandomIntObj(int range, int noOfElements) { int arr[] = generateRandomInts(range, noOfElements); Integer generatedInts[] = new Integer[arr.length]; for (int i = 0; i < arr.length; i++) { generatedInts[i] = arr[i];/* w ww .j a v a2s . co m*/ } return generatedInts; } public static int[] generateRandomInts(int range, int noOfElements) { Random randomGenerator = new Random(); int generatedInts[] = new int[noOfElements]; for (int i = 0; i < generatedInts.length; i++) { generatedInts[i] = randomGenerator.nextInt(range); } return generatedInts; } }