![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法排序
myhAini
300字以内
展开
-
直接插入排序
public class InsertSort { public static void sort(long[] arr ){ long tmp =0 ; int j ; for (int i = 1; i < arr.length; i++) { tmp = arr[i]; j ...原创 2018-08-28 11:17:44 · 106 阅读 · 0 评论 -
冒泡排序
public class Demo1_Array { public static void main(String[] args) { int[] arr = {24, 69, 80, 57, 13}; bubbleSort(arr); print(arr); } public static void bubbleSort(int[] arr)...原创 2018-08-28 11:32:30 · 152 阅读 · 0 评论 -
选择排序
public class SelectionSort { public static void sort(long[] arr){ int k ; long tmp; for (int i = 0; i < arr.length - 1; i++) { k = i; for (int j...原创 2018-08-28 11:35:04 · 138 阅读 · 0 评论 -
线程遇到异常的时候就会释放锁
在这个Service中的Integer.paseInt(“a”)一定会发成异常,然后再测试类中使用了Thread进行了sleep,然后可以观察到结果就是线程A执行的时候已经进入到异常的代码块中。此时已经释放了锁。但是B也启动了线程,但是b不满足判断的条件,所以B进如了else。从这里看出线程遇到异常的时候就会释放锁。package com.mayuhan.throwExceptionLock;...原创 2018-09-25 22:00:34 · 2038 阅读 · 2 评论