前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >BigDecimal 类型 比较大小

BigDecimal 类型 比较大小

作者头像
一写代码就开心
发布2022-11-21 08:28:58
1.2K0
发布2022-11-21 08:28:58
举报
文章被收录于专栏:java和python

目录

1 BigDecimal 类型 比较大小

代码语言:javascript
复制
public class QualityUtils {

    public static void main(String[] args) {
        User user = new User();
        user.setName("ww");
        user.setWindDir(new BigDecimal(-22));
        Boolean windDir = getAirTemp(user.getWindDir());
        System.out.println(windDir);

    }



    /**
     * @description: 判断风向是否在范围内,不在返回true    BigDecimal、
     * 风向的范围  0到360
     * */
    public static Boolean  getWindDir(BigDecimal bigDecimal){
        if(bigDecimal!=null){
            //  进行比较
            BigDecimal zeroinfo = new BigDecimal(0);
            BigDecimal threell = new BigDecimal(360);
            if(bigDecimal.compareTo(zeroinfo) >=0  && bigDecimal.compareTo(threell) <0){
                return false;
            //  如果 传过来的 在 0  到  360  之间
            }else {
                return true;
            }
        }
        return true;
    }

//
    /**
     * @description: 判断本站气压  是否在范围内,不在返回true   BigDecimal
     * 400   到  1080
     * */
    public static Boolean  getStaPress(BigDecimal bigDecimal){
        if(bigDecimal!=null){
            //  进行比较
            BigDecimal zeroinfo = new BigDecimal(400);
            BigDecimal threell = new BigDecimal(1080);
            if(bigDecimal.compareTo(zeroinfo) >=0  && bigDecimal.compareTo(threell) <0){
                return false;
                //  如果 传过来的 在 400  到  1080  之间
            }else {
                return true;
            }
        }
        return true;
    }

//

    /**
     * @description:    判断气温  是否在范围内,不在返回true
     *    -75   到  80
     * */
    public static Boolean  getAirTemp(BigDecimal bigDecimal){
        if(bigDecimal!=null){
            //  进行比较
            BigDecimal zeroinfo = new BigDecimal(-75);
            BigDecimal threell = new BigDecimal(80);
            if(bigDecimal.compareTo(zeroinfo) >=0  && bigDecimal.compareTo(threell) <0){
                return false;
                //  如果 传过来的 在 -75  到  80  之间
            }else {
                return true;
            }
        }
        return true;
    }


//
    /**
     * @description:      判断风速  是否在范围内,不在返回true
     *    0   到  75
     * */
    public static Boolean  getWindSpd(BigDecimal bigDecimal){
        if(bigDecimal!=null){
            //  进行比较
            BigDecimal zeroinfo = new BigDecimal(0);
            BigDecimal threell = new BigDecimal(75);
            if(bigDecimal.compareTo(zeroinfo) >=0  && bigDecimal.compareTo(threell) <0){
                return false;
                //  如果 传过来的 在 -75  到  80  之间
            }else {
                return true;
            }
        }
        return true;
    }
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-11-17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 目录
  • 1 BigDecimal 类型 比较大小
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档