/*
* Main.java
*
* Created on 2006년 7월 25일 (화), 오전 11:12
*
* To change this template, choose Tools | Options and locate the template under
* the Source Creation and Management node. Right-click the template and choose
* Open. You can then make changes to the template in the Source Editor.
*/
package array;
/**
*
* @author Administrator
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
int[] ArrayData ={10,20,50,45,4,22,31,41};
int[] ArrayData1={10,20,50,45,4,22,31,41};
//postfix
for(int i=0;i<ArrayData.length;i++){
for(int j=i;j<ArrayData.length;j++){
if(ArrayData[j]<ArrayData[i]){
int temp=ArrayData[j];
ArrayData[j]=ArrayData[i];
ArrayData[i]=temp;
}
}
}
for(int k= 0; k<ArrayData.length;k++){
System.out.print(ArrayData[k]+ ” “);
}
System.out.println();
//infix
for(int i=(ArrayData1.length)-1;i>=0;i–){
for(int j=0;j<i;j++){
if(ArrayData1[i]<ArrayData1[j]){
int temp=ArrayData1[i];
ArrayData1[i]=ArrayData1[j];
ArrayData1[j]=temp;}
}
}
for(int k= 0; k<ArrayData1.length;k++){
System.out.print(ArrayData1[k]+ ” “);
}
System.out.println();
}
}