在各自岗位上尽职尽责,无需豪言壮语,默默行动会诠释一切。这世界,虽然没有绝对的公平,但是努力就会增加成功和变好的可能性!而这带着未知变量的可能性,就足以让我们普通人拼命去争取了。
欢迎来到~一支会记忆的笔~博客主页

数值的比较

    /**
     * 比较两个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;

    }

 

posted @ 2019-07-24 19:00  一支会记忆的笔  阅读(213)  评论(0编辑  收藏  举报
返回顶部
【学无止境❤️谦卑而行】