Created
January 13, 2010 00:39
-
-
Save johnhmj/275795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.Scanner; | |
public class Main { | |
// Start of main | |
public static void main(String[] args) { | |
PrintStream jout = new PrintStream(System.out); | |
Scanner jin = new Scanner(System.in); | |
int[] number = { 2, 5, 4, 3, 1}; | |
Sort(number); | |
for (int i = 0; i < number.length; i ++) | |
{ | |
jout.printf(" %d", number[i]); | |
} | |
}// End of main | |
public static void Sort(int[] a) | |
{ | |
for (int i = 0; i < a.length; i ++) | |
for (int j = 0; j < a.length; j ++) | |
if ( a[i] < a[j] ) | |
{ | |
int b = a[i]; | |
a[i] = a[j]; | |
a[j] = b; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment