- package com.fo.night;
- public class Text05_maopao {
- /**
- * @param args
- * 选择排序的方法
- */
- public static void main(String[] args) {
- int[] arr = {22,11,33,12,23,34,45,56,67,687,89};
- for (int i = 0; i < arr.length-1; i++) {
- for (int j = i; j < arr.length -1 ; j++) {
- if (arr[j] > arr[j +1 ]) {
- int temp = arr[j];
- arr[j ] = arr[j +1 ];
- arr[j + 1 ] = temp ;
- }
-
- }
- }
- for (int i = 0; i < arr.length ; i++) {
- System.out.print(arr[i] + ",");
- }
- }
- }
复制代码 |
|