package learn; public class maopaopaixu { public static void main(String[] args) { // TODO Auto-generated method stub int sz []= {3,45,33,68,73,98,16,28}; for (int a : sz ) { System.out.print (a + ","); } System.out.println(); for(int c = 0; c<sz.length; c++) { for (int a = 0; a < sz.length - 1; a++) { if (sz[a] > sz[a+1]) { int b = sz[a+1]; sz[a+1] = sz[a]; sz[a] = b; } } } for (int a : sz ) { System.out.print (a + ","); } System.out.println(); } }
时间: 2024-10-13 16:00:16