public class Numbers extends Object
| Modifier and Type | Method and Description |
|---|---|
static BigDecimal |
nullToZero(BigDecimal val)
将
null 转换为 0 |
static BigInteger |
nullToZero(BigInteger val)
将
null 转换为 0 |
static byte |
nullToZero(Byte val)
将
null 转换为 0 |
static double |
nullToZero(Double val)
将
null 转换为 0 |
static float |
nullToZero(Float val)
将
null 转换为 0 |
static int |
nullToZero(Integer val)
将
null 转换为 0 |
static long |
nullToZero(Long val)
将
null 转换为 0 |
static short |
nullToZero(Short val)
将
null 转换为 0 |
static Double |
parseDouble(String str,
Double defaultValue)
|
static Float |
parseFloat(String str,
Float defaultValue)
|
static Integer |
parseInteger(String str,
Integer defaultValue)
|
static Long |
parseLong(String str,
Long defaultValue)
|
static Short |
parseShort(String str,
Short defaultValue)
|
static BigDecimal |
sum(BigDecimal... numbers)
求和
|
static BigInteger |
sum(BigInteger... numbers)
求和
|
static double |
sum(double... numbers)
求和
|
static double |
sum(float... numbers)
求和
|
static long |
sum(int... numbers)
求和
|
static long |
sum(long... numbers)
求和
|
static int |
sum(short... numbers)
求和
|
public static int sum(short... numbers)
numbers - 数据数组public static long sum(int... numbers)
numbers - 数据数组public static long sum(long... numbers)
numbers - 数据数组public static double sum(float... numbers)
numbers - 数据数组public static double sum(double... numbers)
numbers - 数据数组public static BigInteger sum(BigInteger... numbers)
numbers - 数据数组public static BigDecimal sum(BigDecimal... numbers)
numbers - 数据数组public static byte nullToZero(@Nullable Byte val)
null 转换为 0val - 待转换的值val 不为 null,则返回该值;如果值为 null,则返回 0public static short nullToZero(@Nullable Short val)
null 转换为 0val - 待转换的值val 不为 null,则返回该值;如果值为 null,则返回 0public static int nullToZero(@Nullable Integer val)
null 转换为 0val - 待转换的值val 不为 null,则返回该值;如果值为 null,则返回 0public static long nullToZero(@Nullable Long val)
null 转换为 0val - 待转换的值val 不为 null,则返回该值;如果值为 null,则返回 0public static float nullToZero(@Nullable Float val)
null 转换为 0val - 待转换的值val 不为 null,则返回该值;如果值为 null,则返回 0public static double nullToZero(@Nullable Double val)
null 转换为 0val - 待转换的值val 不为 null,则返回该值;如果值为 null,则返回 0@Nonnull public static BigInteger nullToZero(@Nullable BigInteger val)
null 转换为 0val - 待转换的值val 不为 null,则返回该值;如果值为 null,则返回 0@Nonnull public static BigDecimal nullToZero(@Nullable BigDecimal val)
null 转换为 0val - 待转换的值val 不为 null,则返回该值;如果值为 null,则返回 0@Nullable public static Short parseShort(@Nullable String str, @Nullable Short defaultValue)
str - 要转换的字符串defaultValue - 默认值@Nullable public static Integer parseInteger(@Nullable String str, @Nullable Integer defaultValue)
str - 要转换的字符串defaultValue - 默认值@Nullable public static Long parseLong(@Nullable String str, @Nullable Long defaultValue)
str - 要转换的字符串defaultValue - 默认值@Nullable public static Float parseFloat(@Nullable String str, @Nullable Float defaultValue)
str - 要转换的字符串defaultValue - 默认值Copyright © 2026. All rights reserved.