Skip to content

Instantly share code, notes, and snippets.

@devetude
Created April 8, 2017 13:09
Show Gist options
  • Save devetude/54aab89a5e43ab330d79aa222865d183 to your computer and use it in GitHub Desktop.
Save devetude/54aab89a5e43ab330d79aa222865d183 to your computer and use it in GitHub Desktop.
가장 큰 수, 가장 작은 수 찾기 (Find Max, Min Value)
/**
* 가장 큰 수, 가장 작은 수 찾기 (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