• 数字工具类


    package com.zq.utils;

    /**
    *
    * 数字工具类
    *
    * Created by MyEclipse. Author: ChenBin E-mail: chenbin_2008@126.com Date:
    * 2016年12月16日 Time: 下午4:15:22
    */
    public class NumberUtils {

    /**
    * Description : 多个小数相加接口
    *
    * @author : ChenBin
    * @date : 2016年12月16日 下午4:17:04
    */
    public static double plus(Double... nums) {
    double sum = 0.0;
    for (Double num : nums) {
    if (num == null)
    num = 0.0;
    sum += num;
    }
    return sum;
    }

    /**
    * Description : 多个整数相加
    *
    * @author : ChenBin
    * @date : 2017年1月5日 下午2:25:25
    */
    public static Integer plus(Integer... nums) {
    int sum = 0;
    for (Integer i : nums) {
    if (null == i)
    i = 0;
    sum += i;
    }
    return sum;
    }


    /**
    * Description : Double 转 double
    * @author : wangzhiyuan
    * @date : 2017-11-13
    */
    public static double toDouble(Double d){
    if(d == null){
    return 0.00;
    }else{
    return d;
    }
    }


    /**
    * Description : 两Integer判断大小
    * @author : wangzhiyuan
    * @date : 2017-11-16
    */
    public static Long judgeSize(Long n1,Long n2){
    if(n1==null){
    return n2;
    }
    if(n2 ==null){
    return n1;
    }
    if(n1 >= n2){
    return n1;
    }else{
    return n2;
    }
    }


    }

  • 相关阅读:
    OMFCL 使用
    客户化 Summary 页的 Properties
    瑞星升级包下载
    观察者模式Observer
    单例模式Singleton
    java中8大排序
    向上转型和向下转型
    瀑布流的实现
    [转]降级论
    Grid的使用
  • 原文地址:https://www.cnblogs.com/rey888/p/8315941.html
Copyright © 2020-2023  润新知