package com.ssdou;public class DateSort { public static void main(String[] args){ int a[] = {3,2,8,6,7}; int temp = 0; bubbleSort(a); for(int i = 0;i<a.length;i++){ System.out.println(a[i]); } public static int[] bubbleSort(int[] a){ for(int i = a.length-1;i>=1;i--){ for(int j = 0;j<i;j++){ if(a[j+1]<a[j]){ temp = a[j+1]; a[j+1] = a[j]; a[j] = temp; } } } return a; } }}
添加回答
举报
0/150
提交
取消