Number 类
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
*/
public class Number {
public void sort(int a,int b,int c){
int count=0;
int temp=0;
if(a>b){
temp=a;
a=b;
b=temp;
count=count+1;
System.out.println("the count is "+count+" and the result is "+a+" "+b+" "+c);
}
if(a>c){
temp=a;
a=c;
c=temp;
count=count+1;
System.out.println("the count is "+count+" and the result is "+a+" "+b+" "+c);
}
if(b>c){
temp=b;
b=c;
c=temp;
count=count+1;
System.out.println("the count is "+count+" and the result is "+a+" "+b+" "+c);
}
if(count==0){
System.out.println("the count is "+count+" and the result is "+a+" "+b+" "+c);
}
}
}
Test 类
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
*/
public class Test {
public static void main(String[] args){
// int a,b,c;
// Input ip=new Input();
// a=ip.scan();
Number num=new Number();
num.sort(88, 77,22);
}
}