其他分享
首页 > 其他分享> > 冒泡排序

冒泡排序

作者:互联网

package util;

import java.util.Arrays;

/**
* Copyright (C), 2018-2021, Mr.Lin
* Author: Mr.Lin
* Date: 2021/11/6 14:26
* FileName: BubbleSort
* Description: 冒泡排序
*/
public class BubbleSort {
public static void main(String[] args) {
int[] mun = {15, 55, 36, 99, 45, 11, 12, 33};
for (int i = 0; i < mun.length - 1; i++) {
for (int j = 0; j < mun.length - 1 - i; j++) {
if (mun[j] < mun[j + 1]) {
int tomp = mun[j + 1];
mun[j+1] = mun[j];
mun[j]=tomp;
}
}
}
System.out.println(Arrays.toString(mun));
}
}

标签:int,Lin,冒泡排序,BubbleSort,tomp,mun
来源: https://www.cnblogs.com/javaling/p/15516931.html