I got trouble when i try to sort array in for loop.
I give you my code follow:
public class Lottery {
public Lottery() {
java.util.Random iRandom = new java.util.Random();
int num[] = new int[6];
java.util.Arrays.sort(num);
for(int i =0 ; i < num.length; i++) {
java.util.Arrays.sort(num);
num[i] = iRandom.nextInt(49)+1;
System.out.println(num[i]);
}
}
public static void main(String[] args) {
Lottery lott = new Lottery();
}
}
In my above code, i can print random number for using "For Loop" but i try to sort it by ascending but it doesnt work.....
The way i do is right?
Could everybody can help me?
Thank you!
Best Regards!