public class MathUtil extends Object
NumberUtil属于一类工具,NumberUtil偏向于简单数学计算的封装,MathUtil偏向复杂数学计算| Constructor and Description |
|---|
MathUtil() |
| Modifier and Type | Method and Description |
|---|---|
static long |
arrangementCount(int n)
计算排列数,即A(n, n) = n!
|
static long |
arrangementCount(int n,
int m)
计算排列数,即A(n, m) = n!/(n-m)!
|
static List<String[]> |
arrangementSelect(String[] datas)
全排列选择(列表全部参与排列)
|
static List<String[]> |
arrangementSelect(String[] datas,
int m)
排列选择(从列表中选择n个排列)
|
static long |
combinationCount(int n,
int m)
计算组合数,即C(n, m) = n!/((n-m)! * m!)
|
static List<String[]> |
combinationSelect(String[] datas,
int m)
组合选择(从列表中选择n个组合)
|
public static long arrangementCount(int n,
int m)
n - 总数m - 选择的个数public static long arrangementCount(int n)
n - 总数public static List<String[]> arrangementSelect(String[] datas, int m)
datas - 待选列表m - 选择个数public static List<String[]> arrangementSelect(String[] datas)
datas - 待选列表public static long combinationCount(int n,
int m)
n - 总数m - 选择的个数Copyright © 2021. All rights reserved.