Skip to content

Instantly share code, notes, and snippets.

@johnhmj
Created January 13, 2010 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnhmj/275795 to your computer and use it in GitHub Desktop.
Save johnhmj/275795 to your computer and use it in GitHub Desktop.
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