简单for循环进行数组排序
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Arrays;
public class Triangle{
public static void main(String[] args)throws IOException
{
String m=new String("");
int[] a={0,0,0};
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter three numbers:");
m=stdin.readLine();
Scanner scan=new Scanner(m);
for(int i=0;i<3;i++)
{
a[i]=scan.nextInt();
}
Arrays.sort(a);
System.out.println("sorted:");
for(int i=0;i<3;i++)
System.out.print(a[i]+" ");//升序排列
}
}