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

The following examples show how to use cn.hutool.core.util.NumberUtil#div() . 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 getFree() {
    return NumberUtil.div(free, (1024 * 1024), 2);
}
 
Example 3
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getUsed() {
    return NumberUtil.div(used, (1024 * 1024 * 1024), 2);
}
 
Example 4
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getFree() {
    return NumberUtil.div(free, (1024 * 1024), 2);
}
 
Example 5
Source File: MemInfo.java    From Guns with GNU Lesser General Public License v3.0 4 votes vote down vote up
public double getFree() {
    return NumberUtil.div(free, (1024 * 1024 * 1024), 2);
}
 
Example 6
Source File: JvmInfo.java    From Guns with GNU Lesser General Public License v3.0 4 votes vote down vote up
public double getTotal() {
    return NumberUtil.div(total, (1024 * 1024), 2);
}
 
Example 7
Source File: MemInfo.java    From Guns with GNU Lesser General Public License v3.0 4 votes vote down vote up
public double getTotal() {
    return NumberUtil.div(total, (1024 * 1024 * 1024), 2);
}
 
Example 8
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getFree() {
    return NumberUtil.div(free, (1024 * 1024 * 1024), 2);
}
 
Example 9
Source File: Mem.java    From RuoYi with Apache License 2.0 4 votes vote down vote up
public double getUsed() {
    return NumberUtil.div(used, (1024 * 1024 * 1024), 2);
}
 
Example 10
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getTotal() {
    return NumberUtil.div(total, (1024 * 1024 * 1024), 2);
}
 
Example 11
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getUsed() {
    return NumberUtil.div(total - free, (1024 * 1024), 2);
}
 
Example 12
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getMax() {
    return NumberUtil.div(max, (1024 * 1024), 2);
}
 
Example 13
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getTotal() {
    return NumberUtil.div(total, (1024 * 1024), 2);
}
 
Example 14
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getFree() {
    return NumberUtil.div(free, (1024 * 1024 * 1024), 2);
}
 
Example 15
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getFree() {
    return NumberUtil.div(free, (1024 * 1024 * 1024), 2);
}
 
Example 16
Source File: Mem.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getTotal() {
    return NumberUtil.div(total, (1024 * 1024 * 1024), 2);
}
 
Example 17
Source File: MemInfo.java    From Guns with GNU Lesser General Public License v3.0 4 votes vote down vote up
public double getUsed() {
    return NumberUtil.div(used, (1024 * 1024 * 1024), 2);
}
 
Example 18
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getFree() {
    return NumberUtil.div(free, (1024 * 1024), 2);
}
 
Example 19
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getMax() {
    return NumberUtil.div(max, (1024 * 1024), 2);
}
 
Example 20
Source File: Jvm.java    From spring-boot-demo with MIT License 4 votes vote down vote up
public double getTotal() {
    return NumberUtil.div(total, (1024 * 1024), 2);
}