From 93bad2b80df55e7f5ffc9fda06df7f2bff79ff51 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Sat, 11 Jan 2020 14:31:24 -0500 Subject: [PATCH] Changed some primitive ints to Integer class --- mattrixwv/Algorithms.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mattrixwv/Algorithms.java b/mattrixwv/Algorithms.java index 037300d..c79dda2 100644 --- a/mattrixwv/Algorithms.java +++ b/mattrixwv/Algorithms.java @@ -168,7 +168,7 @@ public class Algorithms{ return primes; } //This function gets a certain number of primes - public static ArrayList getNumPrimes(int numberOfPrimes){ + public static ArrayList getNumPrimes(Integer numberOfPrimes){ ArrayList primes = new ArrayList(); //Holds the prime numbers Boolean foundFactor = false; //A flag for whether a factor of the current number has been found @@ -304,7 +304,7 @@ public class Algorithms{ return primes; } //This function returns all factors of goalNumber - public static ArrayList getFactors(int goalNumber){ + public static ArrayList getFactors(Integer goalNumber){ //You need to get all the primes that could be factors of this number so you can test them Double topPossiblePrime = Math.ceil(Math.sqrt(goalNumber)); ArrayList primes = getPrimes(topPossiblePrime.intValue()); @@ -504,7 +504,7 @@ public class Algorithms{ return divisors; } //This function returns all the divisors of goalNumber - public static Integer getFib(int goalSubscript){ + public static Integer getFib(Integer goalSubscript){ //Setup the variables Integer[] fibNums = {1, 1, 0}; //A list to keep track of the Fibonacci numbers. It need only be 3 long because we only need the one we are working on and the last 2 @@ -559,7 +559,7 @@ public class Algorithms{ return fibNums[(fibLoc - 1) % 3]; } //This function returns a list of all Fibonacci numbers <= goalNumber - public static ArrayList getAllFib(int goalNumber){ + public static ArrayList getAllFib(Integer goalNumber){ //Setup the variables ArrayList fibNums = new ArrayList(); //A list to save the Fibonacci numbers @@ -626,7 +626,7 @@ public class Algorithms{ return fibNums; } //This function returns the sum of all elements in the list - public static int getSum(ArrayList nums){ + public static Integer getSum(ArrayList nums){ //If a blank list was passed to the function return 0 as the sum if(nums.size() == 0){ return 0;