//package com.ricky.www;
import java.util.Scanner;
public class OrderTheArray {
public static void main(String[] args){
System.out.println("input ten number:");
Scanner input = new Scanner(System.in);
int[] array = new int[10];
for(int i = 0;i < 10; i ++){
array[i] = input.nextInt();
}
array = orderTheArray(array);
for(int i = 0 ; i < 10; i ++){
System.out.print(array[i] + " ");
}
}
public static int[] orderTheArray(int[] array){
for(int i = 9; i > 0 ; i --){
for(int j = 0 ; j < i ; j ++){
int temp = 0;
if(array[i] < array[j]){
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
return array;
}
}
Note this is called a "Bubble sorting" if I am right. There are some other algorithms common for this task, which I will provide as follows.