最脑残的排序算法-睡眠排序法
发布日期:2021-07-01 04:33:34 浏览次数:2 分类:技术文章

本文共 673 字,大约阅读时间需要 2 分钟。

package com.sleep;/** * @author 第三女神程忆难 * @CSDN https://myhub.blog.csdn.net */public class Main {
public static void main(String[] args) {
int[] arr = {
1, 9, 2, 8, 8, 3, 6, 4, 5, 7}; for (int i1 : arr) {
new SleepThread(i1).start(); } }}class SleepThread extends Thread {
private int number; SleepThread(int number) {
this.number = number; } @Override public void run() {
try {
Thread.sleep(number * 500); } catch (InterruptedException e) {
e.printStackTrace(); } System.out.println(number + ""); }}

在这里插入图片描述

这里*500毫秒,方便看过程,如果数大一点,嗯…

转载地址:https://myhub.blog.csdn.net/article/details/106178299 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:以后正式进入CSDN视频领域
下一篇:Java 适配器模式

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年04月28日 02时44分24秒