Since I didn't understand the data structure at the time, and I didn't know there was a written sorting method in Java, I thought of this bubble sorting method to implement {Declaration: Do not reprint}
Maopaopaixu. Java
Import java. Io .*;
Public class maopaopaixu {
Public static int n = 9;
Public static int [] A = new int [10];
Public static void inputnumbers (){
Inputstreamreader ISR = new inputstreamreader (system. In );
Bufferedreader BR = new bufferedreader (ISR );
For (INT I = 0; I <10; ++ I ){
Try {
String S = Br. Readline ();
A [I] = integer. parseint (s );
} Catch (exception e ){
System. Out. println ("the input is not an integer. The variable is assigned a value of-1! ");
A [I] =-1;
}
}
}
Public static void numbersinputmessage (){
System. Out. println ("the input integer is as follows :");
For (INT I = 0; I <10; ++ I ){
System. Out. Print (A [I] + "/t ");
}
System. Out. println ();
}
Public static void sortintegers (){
For (INT I = 1; I <10; I ++ ){
For (Int J = 0; j <n; ++ J ){
If (A [J]> = A [J + 1]) {
Int temp;
Temp = A [J + 1];
A [J + 1] = A [J];
A [J] = temp;
}
}
N = n-1;
}
}
Public static void sortedoutputmessage (){
System. Out. println ("sort :");
For (INT I = 0; I <10; ++ I ){
System. Out. Print (A [I] + "/t ");
}
}
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs) throws ioexception {
Maopaopaixu. inputnumbers ();
Maopaopaixu. numbersinputmessage ();
Maopaopaixu. sortintegers ();
Maopaopaixu. sortedoutputmessage ();
}
}