public class NumberUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static org.slf4j.Logger |
_Logger
日志记录器
|
static double[] |
_nilDoubles
0项的double数组
|
static int[] |
_nilInts
0项的int数组
|
static long[] |
_nilLongs
0项的long数组
|
| 构造器和说明 |
|---|
NumberUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
isCross(long left1,
long right1,
long left2,
long right2)
判断闭区间是否重合
|
static boolean |
isNumber(char ch)
是否数字
|
static boolean |
isNumber(String str)
是否纯(半角)数字
|
static long |
parseLong(CharSequence chars,
int start,
int end,
int radix) |
static double |
toDouble(String str,
double defaultValue)
转换字串为double
|
static int |
toInt(String str)
转换字串为32位整数
|
static int |
toInt(String str,
int defaultValue)
转换字串为int
|
static long |
toLong(String str)
转换字串为64位整数
|
static long |
toLong(String str,
int defaultValue)
转换字串为long
|
public static final org.slf4j.Logger _Logger
public static final int[] _nilInts
public static final long[] _nilLongs
public static final double[] _nilDoubles
public static final int toInt(String str) throws NumberFormatException
str - 字串NumberFormatException - 格式无效则异常public static int toInt(String str, int defaultValue)
str - 字串defaultValue - 格式无效则使用此值public static final long toLong(String str) throws NumberFormatException
str - 字串NumberFormatException - 格式无效则异常public static long toLong(String str, int defaultValue)
str - 字串defaultValue - 格式无效则使用此值public static double toDouble(String str, double defaultValue)
str - (带小数)数值defaultValue - 格式无效则使用此值public static final boolean isNumber(char ch)
ch - 字符public static final boolean isNumber(String str)
str - 要检查的字串public static boolean isCross(long left1,
long right1,
long left2,
long right2)
throws IllegalArgumentException
left1 - 区间1左值right1 - 区间1右值left2 - 区间2左值right2 - 区间2右值IllegalArgumentException - right大于left时抛出public static long parseLong(CharSequence chars, int start, int end, int radix) throws NumberFormatException
Copyright © 2022. All rights reserved.