i have an assignment to do , all i have to do is write a code in a button, when you click the button a 2 random numbers between 1-10 will appear in one message and i wrote this code
Random r=new Random();
String total = "";
for (int z=0;z<5;z=z+1) {
int x=r.nextInt(10);
total = total+x+"\n";
}
JOptionPane.showMessageDialog(null,total);
my problem now is when the message appear i need to put a stars in front of each random number. for example : i clicked the button, the message appeared, a 5 random numbers appeared like
5
2
3
4
8
i need to write a code to put stars equal each random number like
5 *****
2 **
3 ***
4 ****
8 ********
so, is there any simple code to make this happened ?
p.s : i'm a java beginner so i need a simple code so i can understand it. thanks for your help :)