ANSWER :
CODE :
import java.util.Random;
import java. util. Arrays;
public class Main
{
public static void main (String[]args)
{
// creating object to generate random numbers
Random rand = new Random ();
//
Integer arr[] = new Integer[65536];
for (int i = 0; i < 65536; i++)
{
//random number in range of 70000
Integer random_num = rand.nextInt (70000);
//if already present, generate new random number and then insert
into array
while(Arrays.asList(arr).contains(random_num))
{
random_num = rand.nextInt (70000);
}
arr[i] = random_num;
}
//sorting arrays elements
Arrays.sort(arr);
for (int i = 0; i < 65536; i++)
{
System.out.println(arr[i]);
}
}
}
OUTPUT :
THANK YOU...!!
Get Answers For Free
Most questions answered within 1 hours.