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;
    
        }
  • 相关阅读:
    C# 设置 Excel 条件格式 与 冻结窗口
    Exce折叠效果(数据组合)
    [一点一滴学英语]20050829
    Tencent Messenger
    很有趣的一篇文章:不使用Linux的五大理由
    Tencent Messenger (continued)
    N久没有听过这么搞笑的RAP了
    [一点一滴学英语]20050827
    [Eclipse笔记]SWT真正的优势不是快这么简单
    [一点一滴学英语]20050828
  • 原文地址:https://www.cnblogs.com/JonaLin/p/11240210.html
Copyright © 2011-2022 走看看