LargestInteger.java 477B

12345678910111213141516171819202122
  1. import java.util.*;
  2. public class LargestInteger {
  3. public Integer findLargestNumberUsingConditional(Integer[] integers){
  4. int count = 0;
  5. for(Integer i : integers) {
  6. count = (i > count) ? i:count;
  7. }
  8. return count;
  9. }
  10. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  11. int count = 0;
  12. for(Integer i : integers) {
  13. count = Math.max(i, i);
  14. }
  15. return count;
  16. }
  17. }