![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
普通网友
这个作者很懒,什么都没留下…
展开
-
使用UUID获得一个不重复的16位账号的算法
public static String getAccountIdByUUId() { int machineId = 1;//最大支持1-9个集群机器部署 int hashCodeV = UUID.randomUUID().toString().hashCode(); if(hashCodeV < 0) {//有可能是负数 hashCodeV = - hashCodeV; } ret转载 2017-07-26 00:42:40 · 27520 阅读 · 2 评论 -
求斐波那契数列第n项的优化算法
斐波那契数列指的是这样一个数列:1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...这个数列从第三项开始,每一项都等于前两项之和。public static long fact2(int n,long[] arr) { if(n==0||n==1) { return 1; } if(arr[n]!=0) { return arr[n];转载 2017-07-26 00:48:19 · 1004 阅读 · 0 评论