当前位置 博文首页 > zcy_wxy的博客:常用方法库-长期更新

    zcy_wxy的博客:常用方法库-长期更新

    作者:[db:作者] 时间:2021-08-04 11:52

    文章将会更新一些常用方法,欢迎指出问题或者给出其他常用代码!

        /**
         * 获取Int数组numbers中最大值
         * @param numbers 数组numbers
         * @return 如果数组numbers为空或没有数值,将返回Integer.MIN_VALUE,否则将返回数组中最大值
         */
        public int getMax(int[] numbers){
            if (numbers==null||numbers.length==0){
                return Integer.MIN_VALUE;
            }
            int max=Integer.MIN_VALUE;
            for (int num : numbers) {
                max=Math.max(max,num);
            }
            return max;
        }

    ?

    cs
    下一篇:没有了