zoukankan      html  css  js  c++  java
  • 数值的比较

        /**
         * 比较两个Ineger 数值的大小 返回最小值和最大值
         */
        public static Integer[] compareSize(Integer str1, Integer str2, Integer str3, Integer str4) {
    
            Integer a[] = new Integer[]{str1, str2, str3, str4};
            for (int i = 0; i < a.length; i++) {
                for (int j = 0; j < a.length; j++) {
                    if (a[i] < a[j]) { //由小到大 第一个最小,最后一个最大
                        int b = a[i];
                        a[i] = a[j];
                        a[j] = b;
                    }
                }
            }
    
            return a;
        }
    
        /**
         * 比较四个double类型数字的最大值和最小值
         */
    
        public static double getThreeMax(double a,double b ,double c ,double d){
            double max=a>b ? a : b;
            max=max > c ? max :c ;
            max=max > d ? max :d ;
            return max;
        }
    
    
        /**
         * 比较四个double类型数字的最小值
         */
    
        public static double getThreeMix(double a,double b ,double c ,double d){
            double min=a<b ? a : b;
            min=min < c ? min :c ;
            min=min < d ? min :d ;
            return min;
        }
    
    
    
        /**
         * 判断当前时间是否在指定的时间区间范围
         *
         * @param nowTime
         * @param start
         * @param end
         * @return
         */
        public static Boolean isEffectiveDate(Double nowTime, Double start, Double end) {
    
            if (nowTime.compareTo(start) >= 0 && nowTime.compareTo(end) <= 0) {
                return true;
            } else {
                return false;
            }
        }
    
        /**
         * 当前时间的最小值和指定区间的最大时间相比如果大于区间最大时间 则返回true
         */
    
        public static Boolean compareMinSize(Double mix, Double end) {
    
            if (mix.compareTo(end) > 0) {
                return true;
            }
            return false;
        }
    
        /**
         * 当前时间的最大值和指定区间的最小时间相比如果小于区间最小时间 则返回true
         */
    
        public static Boolean compareMaxSize(Double max, Double start) {
    
            if (max.compareTo(start) < 0) {
                return true;
            }
            return false;
    
        }
  • 相关阅读:
    java 对象导论
    Centos7 中打开和关闭防火墙及端口
    logstash用jdbc插件将数据库内容导入elasticsearch时间字段相差5小时
    git本地库中配置多个sshkey
    elasticsearch报Fielddata is disabled on text fields by default
    centos7环境下安装nginx
    请问一下大佬们,我的项目compile编译的时候总是编译报错
    Elasticsearch安装head插件
    mysql配置主从同步
    centos7中提升用户权限
  • 原文地址:https://www.cnblogs.com/JonaLin/p/11240210.html
Copyright © 2011-2022 走看看