import java.util.*; import java.io.*; public class ShufflingListAndArray{ public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("How many elements you want to add to the list: "); int n = Integer.parseInt(in.readLine()); System.out.print("Enter " + n + " numbers to sort: "); List list = new ArrayList(); for(int i = 0; i < n; i++){ list.add(Integer.parseInt(in.readLine())); } Collections.shuffle(list); Collections.sort(list); System.out.println("List sorting :"+ list); } }