Update NumberUtil.java

优化统计方法
至少三次除法 -> 至多三次加减法+一次除法
This commit is contained in:
Pluto
2024-10-21 17:34:21 +08:00
committed by GitHub
parent 467d67e83a
commit d0bf70f6a8

View File

@@ -2297,7 +2297,7 @@ public class NumberUtil {
* @since 3.0.6 * @since 3.0.6
*/ */
public static int count(int total, int part) { public static int count(int total, int part) {
return (total % part == 0) ? (total / part) : (total / part + 1); return total == 0 ? 0 : (total - 1) / part + 1;
} }
/** /**