Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Troll {
- private static void trollSort(List<Integer> list) {
- if (list.size() > 1) {
- Collections.sort(list);
- }
- }
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- List<Integer> list = new ArrayList<>();
- while (scanner.hasNextInt()) {
- list.add(scanner.nextInt());
- }
- trollSort(list);
- for(int i = 0; i < list.size(); i++) {
- if (i != 0) {
- System.out.print(" ");
- }
- System.out.print(list.get(i));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment