mirror of
https://bitbucket.org/Mattrixwv/javaclasses.git
synced 2025-12-06 23:13:57 -05:00
Updated the README to show the new algorithms
This commit is contained in:
15
README.md
15
README.md
@@ -14,3 +14,18 @@ Example of usage:
|
|||||||
System.out.printf("It took %s to run this algorithm", timer.getStr());
|
System.out.printf("It took %s to run this algorithm", timer.getStr());
|
||||||
//You could also do something like this if you prefered
|
//You could also do something like this if you prefered
|
||||||
System.out.printf("It took %f milliseconds to run this algorithm", timer.getMilli());
|
System.out.printf("It took %f milliseconds to run this algorithm", timer.getMilli());
|
||||||
|
|
||||||
|
#Algorithms
|
||||||
|
This is a class that contains many different algorithms that I have found it useful to keep around.
|
||||||
|
All algorithms are overloaded to allow for using both Integer and BigInteger types.
|
||||||
|
Examples of usage:
|
||||||
|
primes = getPrimes(topNum); //primes now holds all primes less than or equal to topNum
|
||||||
|
primes = getNumPrimes(numPrimes); //primes now holds an ArrayList containing the first numPrimes prime numbers
|
||||||
|
factors = getFactors(number); //factors now holds an ArrayList containing the factors of number
|
||||||
|
divisors = getDivisors(number); //divisors now holds an ArrayList containing all the divisors of number
|
||||||
|
fib = getFib(number); //fib now holds the number element in the fibonacci sequence
|
||||||
|
fib = getAllFib(highestNumber); //fib now holds an ArrayList containing all fibonacci numbers less than or equal to highestNumber
|
||||||
|
sum = getSum(numbers); //sum now holds the sum of all elements in the ArrayList numbers
|
||||||
|
sum = getBigSum(numbers): //Same as getSum, but for BigInteger
|
||||||
|
prod = getProd(numbers); //prod now holds the product of all elements in the ArrayList numbers
|
||||||
|
prod = getBigProd(numbers); //Same as getProd, but for BigInteger
|
||||||
Reference in New Issue
Block a user