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;
    
        }
  • 相关阅读:
    NGINX不允许向静态文件提交POST方式的请求,否则报405错误(apache中没有出现)
    nginx反向代理做cache配置
    Apache与Nginx的优缺点比较
    Nginx配置文件详细说明
    Nginx 配置指令的执行顺序
    不可忽略的apache 的 Keep Alive
    HTTP Keep-Alive详解
    跳转 nginx 跳转 apache跳转
    apache重定向无效
    WebUploader 超大文件上传解决方案:分片断点上传(一)
  • 原文地址:https://www.cnblogs.com/JonaLin/p/11240210.html
Copyright © 2011-2022 走看看