摘要: /** * 斐波那契数列 */public static int fib(int n){ if(n==1) return 0; if(n==2) return 1; return fib(n-1) + fib(n-2);} 阅读全文
posted @ 2019-05-13 12:28 keepup~ 阅读(96) 评论(0) 推荐(0) 编辑
摘要: /** * 单例模式:懒汉式 */class Singleton{ private static volatile Singleton singleton = null; private Singleton(){ } public static Singleton getInstance(){ if 阅读全文
posted @ 2019-05-13 12:05 keepup~ 阅读(116) 评论(0) 推荐(0) 编辑
摘要: /** * 冒泡排序 * @param arr */public static void bubbleSort(int [] arr){ for(int i= 0;i < arr.length -1;i++){ for (int j=0;j < arr.length-1-i;j++){ if(arr 阅读全文
posted @ 2019-05-13 12:04 keepup~ 阅读(166) 评论(0) 推荐(0) 编辑