Merge pull request #3772 from Pluto-Whong/patch-1

优化 “计算等份个数” 方法
This commit is contained in:
Golden Looly
2024-10-29 19:57:33 +08:00
committed by GitHub

View File

@@ -2329,7 +2329,7 @@ public class NumberUtil {
* @since 3.0.6
*/
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;
}
/**