假设:
a<b<c
b为第二大时:
a-b<0
b-c<0
c为第二大时:
a-c<0
c-b<0
否则a为第二大
public int getMid(){
if((a-b)*(b-a)>0){
return b;
}else if((a-c)*(c-b)){
return c;
}else{
return a;
}
}
假设:
a<b<c
b为第二大时:
a-b<0
b-c<0
c为第二大时:
a-c<0
c-b<0
否则a为第二大
public int getMid(){
if((a-b)*(b-a)>0){
return b;
}else if((a-c)*(c-b)){
return c;
}else{
return a;
}
}