Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- Integer numbers[];
- System.out.println("Welcome to the sorting program!");
- System.out.print("Enter size of array: ");
- int size = input.nextInt();
- numbers = new Integer[size];
- int number;
- for(int i=0; i < numbers.length; i++){
- System.out.print("Enter number: ");
- number = input.nextInt();
- numbers[i] = number;
- }
- Arrays.sort(numbers, Collections.reverseOrder());
- for(int i=0; i < numbers.length; i++){
- System.out.println(numbers[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement