学习笔记-pass迭代

    技术2022-05-11  138

    public class Pass {  public static void main(String[] args){   int temp;   int i = 0;   int j;   String str = null;   BufferedReader input = new BufferedReader(new InputStreamReader(System.in));   try {    str = input.readLine();   } catch (IOException e) {    e.printStackTrace();   }   StringTokenizer st = new StringTokenizer(str);   int [] a = new int[st.countTokens()];   while(st.hasMoreTokens()){    a[i] = Integer.parseInt(st.nextToken());    i++;   }      for(i = 0 ;i <a.length-1;i++)    for(j = i+1; j<a.length;j++)          if(a[i]>a[j]){      temp = a[i];      a[i] = a[j];      a[j] = temp;     }   for(i=0 ; i<a.length;i++)    System.out.print(a[i]+"/t");  }   } 

    最新回复(0)