Pete1

Untitled

Apr 2nd, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. package CollectionsHomework;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Collections;
  5. import java.util.List;
  6. import java.util.Scanner;
  7.  
  8.  
  9. public class Problem1SortArrayOfNumbers {
  10. public static void main(String[] args) {
  11. Scanner console = new Scanner(System.in);
  12.  
  13. int numbers = console.nextInt();
  14. ArrayList<Integer> inputNumbers = new ArrayList <Integer>();
  15. for (int i = 0; i <numbers ; i++) {
  16. inputNumbers.add(console.nextInt());
  17. }
  18. Collections.sort(inputNumbers);
  19.  
  20. for (int number:inputNumbers) {
  21. System.out.print(number + " ");
  22.  
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment