Java Code Examples for cn.hutool.core.util.NumberUtil#mul()

The following examples show how to use cn.hutool.core.util.NumberUtil#mul() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HutoolController.java    From mall-learning with Apache License 2.0 6 votes vote down vote up
@ApiOperation("NumberUtil使用:数字处理工具类")
@GetMapping("/numberUtil")
public CommonResult numberUtil() {
    double n1 = 1.234;
    double n2 = 1.234;
    double result;
    //对float、double、BigDecimal做加减乘除操作
    result = NumberUtil.add(n1, n2);
    result = NumberUtil.sub(n1, n2);
    result = NumberUtil.mul(n1, n2);
    result = NumberUtil.div(n1, n2);
    //保留两位小数
    BigDecimal roundNum = NumberUtil.round(n1, 2);
    String n3 = "1.234";
    //判断是否为数字、整数、浮点数
    NumberUtil.isNumber(n3);
    NumberUtil.isInteger(n3);
    NumberUtil.isDouble(n3);
    return CommonResult.success(null, "操作成功");
}
 
Example 2
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(total - free, total, 4), 100);
}
 
Example 3
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(used, total, 4), 100);
}
 
Example 4
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(total - free, total, 4), 100);
}
 
Example 5
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(used, total, 4), 100);
}
 
Example 6
Source File: Jvm.java    From RuoYi with Apache License 2.0 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(total - free, total, 4), 100);
}
 
Example 7
Source File: Mem.java    From RuoYi with Apache License 2.0 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(used, total, 4), 100);
}
 
Example 8
Source File: MemInfo.java    From Guns with GNU Lesser General Public License v3.0 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(used, total, 4), 100);
}
 
Example 9
Source File: JvmInfo.java    From Guns with GNU Lesser General Public License v3.0 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(total - free, total, 4), 100);
}
 
Example 10
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(total - free, total, 4), 100);
}
 
Example 11
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getUsage() {
    return NumberUtil.mul(NumberUtil.div(used, total, 4), 100);
}