public class Numbers extends Object
Modifier and Type | Method and Description |
---|---|
static byte |
avg(byte... array) |
static double |
avg(double... array) |
static float |
avg(float... array) |
static int |
avg(int... array) |
static long |
avg(long... array) |
static short |
avg(short... array) |
static long |
cleanDecimal(double d)
清空小数
|
static int |
cleanDecimal(float f)
清空小数
|
static String |
cleanDoubleDecimal(double d)
清空小数
|
static String |
cleanFloatDecimal(float f)
清空小数
|
static int |
compare(byte x,
byte y)
比较接口
|
static int |
compare(double x,
double y) |
static int |
compare(float x,
float y) |
static int |
compare(int x,
int y) |
static int |
compare(long x,
long y) |
static int |
compare(short x,
short y) |
static boolean |
cross(byte start1,
byte end1,
byte start2,
byte end2)
交差
|
static boolean |
cross(double start1,
double end1,
double start2,
double end2) |
static boolean |
cross(float start1,
float end1,
float start2,
float end2) |
static boolean |
cross(int start1,
int end1,
int start2,
int end2) |
static boolean |
cross(long start1,
long end1,
long start2,
long end2) |
static boolean |
cross(short start1,
short end1,
short start2,
short end2) |
static String |
format(double value,
String format)
格式化
|
static String |
format(float value,
String format)
格式化
|
static int |
getMin2Power(int c)
获取最小二次幂
|
static int |
getRangeNum(int num,
int startRange,
int endRange)
将给定的数除余为指定区间中的数
|
static boolean |
gteZero(byte x)
是否大于等于0
|
static boolean |
gteZero(double x) |
static boolean |
gteZero(float x) |
static boolean |
gteZero(int x) |
static boolean |
gteZero(long x) |
static boolean |
gteZero(short x) |
static boolean |
gtZero(byte x)
是否大于0
|
static boolean |
gtZero(double x) |
static boolean |
gtZero(float x) |
static boolean |
gtZero(int x) |
static boolean |
gtZero(long x) |
static boolean |
gtZero(short x) |
static boolean |
inRange(byte num,
byte start,
byte end)
判断是否在区间内 开区间
|
static boolean |
inRange(double num,
double start,
double end) |
static boolean |
inRange(float num,
float start,
float end) |
static boolean |
inRange(int num,
int start,
int end) |
static boolean |
inRange(long num,
long start,
long end) |
static boolean |
inRange(short num,
short start,
short end) |
static boolean |
isAllNaN(double... array) |
static boolean |
isAllNaN(float... array)
是否全为NaN
|
static boolean |
isAllNegative(byte... array)
是否全为负数
|
static boolean |
isAllNegative(double... array) |
static boolean |
isAllNegative(float... array) |
static boolean |
isAllNegative(int... array) |
static boolean |
isAllNegative(long... array) |
static boolean |
isAllNegative(short... array) |
static boolean |
isAllZero(byte... array)
是否全部为0
|
static boolean |
isAllZero(double... array) |
static boolean |
isAllZero(float... array) |
static boolean |
isAllZero(int... array) |
static boolean |
isAllZero(long... array) |
static boolean |
isAllZero(short... array) |
static boolean |
isDecimal(double d)
是否有小数位
|
static boolean |
isDecimal(float f)
是否有小数位
|
static boolean |
isNaN(Double x) |
static boolean |
isNaN(Float x)
是否为NaN
|
static boolean |
isNegative(byte x)
是否为负数
|
static boolean |
isNegative(double x) |
static boolean |
isNegative(float x) |
static boolean |
isNegative(int x) |
static boolean |
isNegative(long x) |
static boolean |
isNegative(short x) |
static boolean |
isNoneNaN(double... array) |
static boolean |
isNoneNaN(float... array)
是否全不为NaN
|
static boolean |
isNoneNegative(byte... array)
是否全不为负数
|
static boolean |
isNoneNegative(double... array) |
static boolean |
isNoneNegative(float... array) |
static boolean |
isNoneNegative(int... array) |
static boolean |
isNoneNegative(long... array) |
static boolean |
isNoneNegative(short... array) |
static boolean |
isNoneZero(byte... array)
是否全部不为0
|
static boolean |
isNoneZero(double... array) |
static boolean |
isNoneZero(float... array) |
static boolean |
isNoneZero(int... array) |
static boolean |
isNoneZero(long... array) |
static boolean |
isNoneZero(short... array) |
static boolean |
isNotNaN(Double x) |
static boolean |
isNotNaN(Float x)
是否不为NaN
|
static boolean |
isNotNegative(byte x)
是否不为负数
|
static boolean |
isNotNegative(double x) |
static boolean |
isNotNegative(float x) |
static boolean |
isNotNegative(int x) |
static boolean |
isNotNegative(long x) |
static boolean |
isNotNegative(short x) |
static boolean |
isNotZero(byte x)
是否不为0
|
static boolean |
isNotZero(double x) |
static boolean |
isNotZero(float x) |
static boolean |
isNotZero(int x) |
static boolean |
isNotZero(long x) |
static boolean |
isNotZero(short x) |
static boolean |
isZero(byte x)
是否为0
|
static boolean |
isZero(double x) |
static boolean |
isZero(float x) |
static boolean |
isZero(int x) |
static boolean |
isZero(long x) |
static boolean |
isZero(short x) |
static boolean |
lteZero(byte x)
是否小于等于0
|
static boolean |
lteZero(double x) |
static boolean |
lteZero(float x) |
static boolean |
lteZero(int x) |
static boolean |
lteZero(long x) |
static boolean |
lteZero(short x) |
static boolean |
ltZero(byte x)
是否小于0
|
static boolean |
ltZero(double x) |
static boolean |
ltZero(float x) |
static boolean |
ltZero(int x) |
static boolean |
ltZero(long x) |
static boolean |
ltZero(short x) |
static byte |
max(byte... array)
最大值
|
static double |
max(double... array) |
static float |
max(float... array) |
static int |
max(int... array) |
static long |
max(long... array) |
static short |
max(short... array) |
static byte |
min(byte... array)
最小值
|
static double |
min(double... array) |
static float |
min(float... array) |
static int |
min(int... array) |
static long |
min(long... array) |
static short |
min(short... array) |
static boolean |
notInRange(byte num,
byte start,
byte end)
判断是否不在区间内 开区间
|
static boolean |
notInRange(double num,
double start,
double end) |
static boolean |
notInRange(float num,
float start,
float end) |
static boolean |
notInRange(int num,
int start,
int end) |
static boolean |
notInRange(long num,
long start,
long end) |
static boolean |
notInRange(short num,
short start,
short end) |
static boolean |
rangeInRange(byte rangeStart,
byte rangeEnd,
byte testRangeStart,
byte testRangeEnd)
判断一个区间是否在另一个区间内 开区间
|
static boolean |
rangeInRange(double rangeStart,
double rangeEnd,
double testRangeStart,
double testRangeEnd) |
static boolean |
rangeInRange(float rangeStart,
float rangeEnd,
float testRangeStart,
float testRangeEnd) |
static boolean |
rangeInRange(int rangeStart,
int rangeEnd,
int testRangeStart,
int testRangeEnd) |
static boolean |
rangeInRange(long rangeStart,
long rangeEnd,
long testRangeStart,
long testRangeEnd) |
static boolean |
rangeInRange(short rangeStart,
short rangeEnd,
short testRangeStart,
short testRangeEnd) |
static boolean |
rangeNotInRange(byte rangeStart,
byte rangeEnd,
byte testRangeStart,
byte testRangeEnd)
判断一个区间是否不在另一个区间内 开区间
|
static boolean |
rangeNotInRange(double rangeStart,
double rangeEnd,
double testRangeStart,
double testRangeEnd) |
static boolean |
rangeNotInRange(float rangeStart,
float rangeEnd,
float testRangeStart,
float testRangeEnd) |
static boolean |
rangeNotInRange(int rangeStart,
int rangeEnd,
int testRangeStart,
int testRangeEnd) |
static boolean |
rangeNotInRange(long rangeStart,
long rangeEnd,
long testRangeStart,
long testRangeEnd) |
static boolean |
rangeNotInRange(short rangeStart,
short rangeEnd,
short testRangeStart,
short testRangeEnd) |
static String |
setScale(double d,
int decimalLen)
设置小数位
|
static String |
setScale(float f,
int decimalLen)
设置小数位
|
static long |
sum(byte... array) |
static double |
sum(double... array) |
static double |
sum(float... array) |
static long |
sum(int... array) |
static long |
sum(long... array) |
static long |
sum(short... array) |
static boolean |
uncross(byte start1,
byte end1,
byte start2,
byte end2)
不交叉
|
static boolean |
uncross(double start1,
double end1,
double start2,
double end2) |
static boolean |
uncross(float start1,
float end1,
float start2,
float end2) |
static boolean |
uncross(int start1,
int end1,
int start2,
int end2) |
static boolean |
uncross(long start1,
long end1,
long start2,
long end2) |
static boolean |
uncross(short start1,
short end1,
short start2,
short end2) |
public static int getRangeNum(int num, int startRange, int endRange)
num
- numstartRange
- 区间开始endRange
- 区间结束public static boolean isZero(byte x)
x
- ignorepublic static boolean isZero(short x)
public static boolean isZero(int x)
public static boolean isZero(long x)
public static boolean isZero(float x)
public static boolean isZero(double x)
public static boolean isNotZero(byte x)
x
- ignorepublic static boolean isNotZero(short x)
public static boolean isNotZero(int x)
public static boolean isNotZero(long x)
public static boolean isNotZero(float x)
public static boolean isNotZero(double x)
public static boolean ltZero(byte x)
x
- xpublic static boolean ltZero(short x)
public static boolean ltZero(int x)
public static boolean ltZero(long x)
public static boolean ltZero(float x)
public static boolean ltZero(double x)
public static boolean lteZero(byte x)
x
- xpublic static boolean lteZero(short x)
public static boolean lteZero(int x)
public static boolean lteZero(long x)
public static boolean lteZero(float x)
public static boolean lteZero(double x)
public static boolean gtZero(byte x)
x
- xpublic static boolean gtZero(short x)
public static boolean gtZero(int x)
public static boolean gtZero(long x)
public static boolean gtZero(float x)
public static boolean gtZero(double x)
public static boolean gteZero(byte x)
x
- xpublic static boolean gteZero(short x)
public static boolean gteZero(int x)
public static boolean gteZero(long x)
public static boolean gteZero(float x)
public static boolean gteZero(double x)
public static boolean isAllZero(byte... array)
array
- arraypublic static boolean isAllZero(short... array)
public static boolean isAllZero(int... array)
public static boolean isAllZero(long... array)
public static boolean isAllZero(float... array)
public static boolean isAllZero(double... array)
public static boolean isNoneZero(byte... array)
array
- arraypublic static boolean isNoneZero(short... array)
public static boolean isNoneZero(int... array)
public static boolean isNoneZero(long... array)
public static boolean isNoneZero(float... array)
public static boolean isNoneZero(double... array)
public static boolean isNegative(byte x)
x
- ignorepublic static boolean isNegative(short x)
public static boolean isNegative(int x)
public static boolean isNegative(long x)
public static boolean isNegative(float x)
public static boolean isNegative(double x)
public static boolean isNotNegative(byte x)
x
- ignorepublic static boolean isNotNegative(short x)
public static boolean isNotNegative(int x)
public static boolean isNotNegative(long x)
public static boolean isNotNegative(float x)
public static boolean isNotNegative(double x)
public static boolean isAllNegative(byte... array)
array
- arraypublic static boolean isAllNegative(short... array)
public static boolean isAllNegative(int... array)
public static boolean isAllNegative(long... array)
public static boolean isAllNegative(float... array)
public static boolean isAllNegative(double... array)
public static boolean isNoneNegative(byte... array)
array
- arraypublic static boolean isNoneNegative(short... array)
public static boolean isNoneNegative(int... array)
public static boolean isNoneNegative(long... array)
public static boolean isNoneNegative(float... array)
public static boolean isNoneNegative(double... array)
public static boolean isNaN(Float x)
x
- ignorepublic static boolean isNaN(Double x)
public static boolean isNotNaN(Float x)
x
- ignorepublic static boolean isNotNaN(Double x)
public static boolean isAllNaN(float... array)
array
- arraypublic static boolean isAllNaN(double... array)
public static boolean isNoneNaN(float... array)
array
- arraypublic static boolean isNoneNaN(double... array)
public static int compare(byte x, byte y)
x
- xy
- ypublic static int compare(short x, short y)
public static int compare(int x, int y)
public static int compare(long x, long y)
public static int compare(float x, float y)
public static int compare(double x, double y)
public static byte min(byte... array)
array
- arraypublic static short min(short... array)
public static int min(int... array)
public static long min(long... array)
public static float min(float... array)
public static double min(double... array)
public static byte max(byte... array)
array
- arraypublic static short max(short... array)
public static int max(int... array)
public static long max(long... array)
public static float max(float... array)
public static double max(double... array)
public static long sum(byte... array)
public static long sum(short... array)
public static long sum(int... array)
public static long sum(long... array)
public static double sum(float... array)
public static double sum(double... array)
public static byte avg(byte... array)
public static short avg(short... array)
public static int avg(int... array)
public static long avg(long... array)
public static float avg(float... array)
public static double avg(double... array)
public static boolean inRange(byte num, byte start, byte end)
num
- 测试的数字start
- 区间开始end
- 区间结束public static boolean inRange(short num, short start, short end)
public static boolean inRange(int num, int start, int end)
public static boolean inRange(long num, long start, long end)
public static boolean inRange(float num, float start, float end)
public static boolean inRange(double num, double start, double end)
public static boolean notInRange(byte num, byte start, byte end)
num
- 测试的数字start
- 区间开始end
- 区间结束
[1, 1] 1 true
[1, 2] 1 truepublic static boolean notInRange(short num, short start, short end)
public static boolean notInRange(int num, int start, int end)
public static boolean notInRange(long num, long start, long end)
public static boolean notInRange(float num, float start, float end)
public static boolean notInRange(double num, double start, double end)
public static boolean rangeInRange(byte rangeStart, byte rangeEnd, byte testRangeStart, byte testRangeEnd)
rangeStart
- 区间开始rangeEnd
- 区间结束testRangeStart
- 测试的区间开始testRangeEnd
- 测试的区间结束
[1, 1], [1, 1] true
[1, 2], [1, 1] true
[1, 2], [1, 2] truepublic static boolean rangeInRange(short rangeStart, short rangeEnd, short testRangeStart, short testRangeEnd)
public static boolean rangeInRange(int rangeStart, int rangeEnd, int testRangeStart, int testRangeEnd)
public static boolean rangeInRange(long rangeStart, long rangeEnd, long testRangeStart, long testRangeEnd)
public static boolean rangeInRange(float rangeStart, float rangeEnd, float testRangeStart, float testRangeEnd)
public static boolean rangeInRange(double rangeStart, double rangeEnd, double testRangeStart, double testRangeEnd)
public static boolean rangeNotInRange(byte rangeStart, byte rangeEnd, byte testRangeStart, byte testRangeEnd)
rangeStart
- 区间开始rangeEnd
- 区间结束testRangeStart
- 测试的区间开始testRangeEnd
- 测试的区间结束public static boolean rangeNotInRange(short rangeStart, short rangeEnd, short testRangeStart, short testRangeEnd)
public static boolean rangeNotInRange(int rangeStart, int rangeEnd, int testRangeStart, int testRangeEnd)
public static boolean rangeNotInRange(long rangeStart, long rangeEnd, long testRangeStart, long testRangeEnd)
public static boolean rangeNotInRange(float rangeStart, float rangeEnd, float testRangeStart, float testRangeEnd)
public static boolean rangeNotInRange(double rangeStart, double rangeEnd, double testRangeStart, double testRangeEnd)
public static boolean cross(byte start1, byte end1, byte start2, byte end2)
start1
- 开始区间1end1
- 结束区间1start2
- 开始区间2end2
- 结束区间2
[1, 1] [1, 1] false
[1, 1] [1, 2] false
[1, 2] [1, 1] false
[1, 2] [2, 3] false
[1, 2] [1, 2] truepublic static boolean cross(short start1, short end1, short start2, short end2)
public static boolean cross(int start1, int end1, int start2, int end2)
public static boolean cross(long start1, long end1, long start2, long end2)
public static boolean cross(float start1, float end1, float start2, float end2)
public static boolean cross(double start1, double end1, double start2, double end2)
public static boolean uncross(byte start1, byte end1, byte start2, byte end2)
start1
- 开始区间1end1
- 结束区间1start2
- 开始区间2end2
- 结束区间2public static boolean uncross(short start1, short end1, short start2, short end2)
public static boolean uncross(int start1, int end1, int start2, int end2)
public static boolean uncross(long start1, long end1, long start2, long end2)
public static boolean uncross(float start1, float end1, float start2, float end2)
public static boolean uncross(double start1, double end1, double start2, double end2)
public static String format(float value, String format)
value
- valueformat
- formatpublic static String format(double value, String format)
value
- valueformat
- formatpublic static int cleanDecimal(float f)
f
- floatpublic static long cleanDecimal(double d)
d
- doublepublic static String cleanFloatDecimal(float f)
f
- floatpublic static String cleanDoubleDecimal(double d)
d
- doublepublic static String setScale(double d, int decimalLen)
d
- doubledecimalLen
- 小数位public static String setScale(float f, int decimalLen)
f
- floatdecimalLen
- 小数位public static boolean isDecimal(float f)
f
- floatpublic static boolean isDecimal(double d)
d
- doublepublic static int getMin2Power(int c)
c
- numCopyright © 2024. All rights reserved.