i need a code that can print 6 random numbers. the first five numbers have to be from 51-100 and the sixth one has to be from 1-50, the numbers cannot repeat and they have to be sorted from greatest to least. i got the first two parts right but idk how to sort them after they've been shuffled. can someone please help me or give me some tips.
import java.util.Random; import java.util.Collections; import java.util.ArrayList; public class Lottery { public static void main(String[] args) { ArrayList<Integer> numbers = new ArrayList<Integer>(); for(int i = 51; i < 100; i++) { numbers.add(i); } Collections.shuffle(numbers); System.out.print("This week's lottery numbers are: "); for(int j =0; j < 5; j++) { System.out.print(numbers.get(j) + " "); } Random f = new Random(); { int lastnum=f.nextInt(50) + 1; System.out.print(" "+lastnum); } } }