package never; import java.util.Arrays; public class Maopao{ public static void main(String args[]){ int arr[] = {12,3,13,5,56,34,99,24,57,21,2}; System.out.println("排序前的数组为:"); System.out.println(Arrays.toString(arr)); for(int j = 0;j<arr.length-1;j++){ for (int i = 0; i < arr.length-1; i++) { if(arr[i]>arr[i+1]){ int k; k = arr[i+1]; arr[i+1] = arr[i]; arr[i] = k; } } } System.out.println(); System.out.println("排序后的数组为:"); System.out.println(Arrays.toString(arr)); } }
初级程序员
by: 雨落冬夜 发表于:2017-04-19 11:44:50 顶(1) | 踩(0) 回复
今天刚看过这个
回复评论