-
java冒泡排序
- public class Maopao {
- public static void main(String[] args) {
- int[] array={1,2,5,3,10,21,0};
- getSortD_X(array);
- getSortX_D(array);
- }
- public static void getSortD_X(int[] array){
- for (int i = 0; i < array.length; i++) {
- for(int j=0;j<array.length-1;j++){
- if(array[i]>array[j]){
- int temp=array[i];
- array[i]=array[j];
- array[j]=temp;
- }
- }
- }
- System.out.print("从大到小:");
- for (int i = 0; i < array.length; i++) {
- if(i==array.length-1){
- System.out.println(array[i]);
- }else{
- System.out.print(array[i]+",");
- }
- }
- }
- public static void getSortX_D(int[] array){
- for (int i = 0; i <array.length; i++) {
- for(int j=0;j<array.length-i-1;j++){
- if(array[j]>array[j+1]){
- int temp=array[j];
- array[j]=array[j+1];
- array[j+1]=temp;
- }
- }
- }
- System.out.print("从小到大:");
- for (int i = 0; i < array.length; i++) {
- if(i==array.length-1){
- System.out.println(array[i]);
- }else{
- System.out.print(array[i]+",");
- }
- }
- }
- }
-
相关阅读:
mybatis 错误 Invalid bound statement (not found)
Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
bug 记录 Unable to start ServletWebServerApplicationContext due to multiple ServletWebServerFactory beans
解决:The Tomcat connector configured to listen on port 8182 failed to start. The port may already be in use or the connector may be misconfigured.
jquery validate 验证插件 解决多个相同的Name 只验证第一个的方案
phpStorm+xdebug调试(php7.3)
小程序视频多个视频播放与暂停
CSS实现单行、多行文本溢出显示省略号(…)
Packet for query is too large (4,544,730 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.
idea自动在文件头中添加作者和创建时间
-
原文地址:https://www.cnblogs.com/Yxxxxx/p/6858671.html
Copyright © 2020-2023
润新知