I have tried with array, but it seems i always miss 3 point, (comment you see all the try)so i tried wirh Math. Max and still not working on 3 point.
I don't understand , please tell me what is wrong that I miss 3 point.
Really thank you.
package com.codegym.task.task04.task0420;
/*
Sorting three numbers
*/
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner s = new Scanner(System.in);
int n1 = s.nextInt();
int n2 = s.nextInt();
int n3 = s.nextInt();
Integer [] ar = {n1, n2, n3};
System.out.println();
Arrays.sort(ar, Collections.reverseOrder());
//for (int num : ar) {
//System.out.print(" " + num);
/*System.out.print(ar[0]);
for (int i = 1; i < ar.length; i++) {
System.out.print(" " + ar[i]);*/
/*StringBuilder sb = new StringBuilder();
for (int i : ar) { sb.append(i).append(" ");
} System.out.println(sb.toString().trim());
*/
/*System.out.println(Arrays.stream(ar).map(Object::toString).collect(Collectors.joining(" ")));
*/
/*String[] strings = new String[ar.length];
for (int i = 0; i < ar.length; i++)
{ strings[i] = String.valueOf(ar[i]);
}
System.out.println(String.join(" ", strings));
*/
int max = Math.max(n3, Math.max(n1,n2));
int min = Math.min(n3, Math.min(n1,n2));
int sum = (n1+ n2+n3) -max - min;
System.out.print(max + " " + sum + " " + min);
}
}