LargestInteger.java 499B

123456789101112131415161718
  1. import java.util.*;
  2. public class LargestInteger {
  3. public Integer findLargestNumberUsingConditional(Integer[] integers){
  4. int highestNum = integers[0];
  5. for (int i = 0; i < integers.length; i++){
  6. if (i > highestNum){
  7. highestNum = integers[i];
  8. }
  9. }
  10. return highestNum;
  11. }
  12. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  13. return Math.max(integers[0],(Math.max(integers[1],integers[2])));
  14. }
  15. }