![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java
墨笛99
这个作者很懒,什么都没留下…
展开
-
二分查找算法
/** * 二分查找算法,交替高低位索引来判断 * * @param arr * @param s * @return 查询s在数组arr中的索引 */ public static int getIndex(int[] arr, int s) { if (arr != null) { int low = 0;//低位 int high = arr.length - 1;//高位 while (low <= high) { .原创 2020-12-16 14:57:44 · 56 阅读 · 0 评论 -
Java中Math.round()方法的取整规则
just一句话:取最近的正数,当有两个最近的正数时,就取最大的那个! 举个例子: public class Test { public static void main(String[] args) { System.out.println(Math.round(10.6));//11 System.out.println(Math.round(-10.6));//-11 System.out.println(Math.round(9.5));/原创 2020-09-25 15:14:11 · 322 阅读 · 0 评论