⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mathutils.java

📁 基于netbeans的java桌面应用程序合集
💻 JAVA
字号:
package com.sun.tiger.vararg;

public class MathUtils {
    
    public static int max(int... values) {
        if (values.length == 0) {
            throw new IllegalArgumentException("No values supplied.");
        }
        
        int max = Integer.MIN_VALUE;
        for (int i : values) {
            if (i > max)
                max = i;
        }
        return max;
    }

    
    public static void main(String[] args) {
        int max;
//        int max = max(1,2,3,4,5,6,7,8);
//        int max = max(new int[]{2,4,6,8});
         max = max();
//      System.out.println(max);
//
//      max = max(2,4,6,8);
//      System.out.println(max);
//
//      max = max(0);
//      System.out.println(max);
//
//      max = max();
      System.out.println(max);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -