public class NumberUtil extends Object
| Constructor and Description |
|---|
NumberUtil() |
| Modifier and Type | Method and Description |
|---|---|
static double |
dealDecimal(double d,
DecimalFormat df)
deal the decimal by the decimal format
|
static double |
dealDecimal(double d,
int num)
deal the decimal to define number decimal places
|
static double |
formatDaouble(double number,
int digits) |
static double |
getDoubleValue(Object object)
将对象转出成double
|
static double |
getDoubleValue(Object object,
double defaultValue) |
static int |
getIntValue(Object object)
将对象转出成int
|
static int |
getIntValue(Object object,
int defaultValue)
将对象转出成int
|
static long |
getLongValue(Object object)
将对象转出成int
|
static long |
getLongValue(Object object,
long defaultValue) |
static String |
getNumInt(Object obj) |
static String |
getNumTInt(Object obj) |
static String |
getNumTPoint(Object obj) |
static String |
getPercent(Object obj)
格式化百分比
|
static String |
getPercent(String str1,
String str2) |
static String |
getPercent(String str1,
String str2,
int decimalNum) |
static int |
getRandNum(int start,
int end)
返回指定范围的随机数
|
static int |
getTimeValue(Object object) |
static boolean |
isNum(String str)
判断是否是数字
|
static void |
main(String[] args) |
static double |
parseDouble(Object obj) |
static float |
parseFloat(Object obj) |
static long |
parseLong(Object obj) |
static int |
parseNumber(Object obj) |
static String |
toNumStr(Object obj) |
public static boolean isNum(String str)
str - public static int parseNumber(Object obj)
public static long parseLong(Object obj)
obj - public static double parseDouble(Object obj)
obj - public static float parseFloat(Object obj)
obj - public static double dealDecimal(double d,
DecimalFormat df)
d - df - public static double dealDecimal(double d,
int num)
d - num - decimal placespublic static int getRandNum(int start,
int end)
start - end - public static double formatDaouble(double number,
int digits)
public static int getIntValue(Object object)
object - public static int getIntValue(Object object, int defaultValue)
object - public static long getLongValue(Object object)
object - public static long getLongValue(Object object, long defaultValue)
public static int getTimeValue(Object object)
public static double getDoubleValue(Object object)
object - public static double getDoubleValue(Object object, double defaultValue)
public static void main(String[] args)
Copyright © 2020. All rights reserved.