LargestInteger.java 605B

123456789101112131415161718192021222324252627282930
  1. import java.util.*;
  2. public class LargestInteger {
  3. public Integer findLargestNumberUsingConditional(Integer[] integers){
  4. //30,20,10
  5. int maxValue = 0;
  6. //int count = 0;
  7. for (int count = 0; count < integers.length; count++){
  8. if(integers[count]>maxValue){
  9. maxValue = integers[count];
  10. }
  11. //return maxValue;
  12. }
  13. return maxValue;
  14. }
  15. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  16. return Math.max(integers[0],(Math.max(integers[1], integers[2])));
  17. }
  18. }