Last active
August 29, 2015 14:19
-
-
Save shcherbakoff/b898d16cefb4f4078532 to your computer and use it in GitHub Desktop.
package com.javarush.test.level04.lesson06.task03;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level04.lesson06.task03; | |
/* Сортировка трех чисел | |
Ввести с клавиатуры три числа, и вывести их в порядке убывания. | |
*/ | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.Arrays; | |
import java.util.Collections; | |
public class Solution | |
{ | |
public static void main(String[] args) throws Exception | |
{ | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
Integer [] array = new Integer [3]; | |
for(int i=0; i < array.length; i++) | |
{ | |
array [i] = Integer.parseInt(reader.readLine()); | |
} | |
Arrays.sort(array, Collections.reverseOrder()); //используем сортировку по убыванию методом sort(). Метод пузырька отстой)))) | |
for (Integer a : array) | |
{ | |
System.out.println(a); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment