Created
April 8, 2017 13:09
-
-
Save devetude/54aab89a5e43ab330d79aa222865d183 to your computer and use it in GitHub Desktop.
가장 큰 수, 가장 작은 수 찾기 (Find Max, Min Value)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 가장 큰 수, 가장 작은 수 찾기 (Find Max, Min Value) | |
* | |
* @author devetude | |
*/ | |
public class Main { | |
private static final int[] NUMS = { 10, 20, 25, 35, 45, 55, 60, 75, 80, 90, 95 }; | |
public static void main(String args[]) throws Exception { | |
int max = Integer.MIN_VALUE; | |
int min = Integer.MAX_VALUE; | |
for (final int NUM : NUMS) { | |
max = Math.max(max, NUM); | |
min = Math.min(min, NUM); | |
} | |
StringBuilder sb = new StringBuilder(); | |
sb.append("max : ").append(max).append(" min : ").append(min); | |
System.out.println(sb.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment