changing my program to array working program
Code:
import java.util.Random;
public class Random100
{
/*This is a program to generate random numbers between
1 and 999 with no repetitions in the sequence */
public static void main(String[] args)
{
Random rand = new Random();
for (int count = 0; count < 10; count++) //allocates the rows of 10 x 10 random numbers
{
System.out.println();
for (int i = 0; i < 10; i++)
{
int gennum = rand.nextInt(999); //This is the maximum that the program generates the numbers to
int finalnum = String.valueOf(gennum).length();
if (finalnum == 1) //if the final number has one number so say 9 the program will add two zero's
{
System.out.print("00" + (gennum) + " ");
}
if (finalnum == 2) //if the final number has two numbers so say 19 the program will add one zero
{
System.out.print("0" + (gennum) + " ");
}
if (finalnum == 3) //and if program has three numbers the program will just output the generated number
{
System.out.print((gennum) + " ");
}
}
}
}
}
hi guys i have my program up and running no problems but i need to change it to an array program. im new to java and finding this part quite difficult any input would be appreciated alot