Fixed typos and comments
This commit is contained in:
@@ -34,6 +34,7 @@ import mattrixwv.exceptions.InvalidResult;
|
|||||||
|
|
||||||
|
|
||||||
public class Algorithms{
|
public class Algorithms{
|
||||||
|
//?This is here just to prove that templates exist and for a possible rewrite at a later time
|
||||||
public static <T> T getNum(T num1){
|
public static <T> T getNum(T num1){
|
||||||
return num1;
|
return num1;
|
||||||
}
|
}
|
||||||
@@ -324,7 +325,6 @@ public class Algorithms{
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//This function return true if the value passed to it is prime
|
|
||||||
public static boolean isPrime(long possiblePrime){
|
public static boolean isPrime(long possiblePrime){
|
||||||
if(possiblePrime <= 3){
|
if(possiblePrime <= 3){
|
||||||
return possiblePrime > 1;
|
return possiblePrime > 1;
|
||||||
@@ -339,7 +339,6 @@ public class Algorithms{
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//This function return true if the value passed to it is prime
|
|
||||||
public static boolean isPrime(BigInteger possiblePrime){
|
public static boolean isPrime(BigInteger possiblePrime){
|
||||||
if(possiblePrime.compareTo(BigInteger.valueOf(3)) <= 0){
|
if(possiblePrime.compareTo(BigInteger.valueOf(3)) <= 0){
|
||||||
return possiblePrime.compareTo(BigInteger.ONE) > 0;
|
return possiblePrime.compareTo(BigInteger.ONE) > 0;
|
||||||
@@ -749,7 +748,7 @@ public class Algorithms{
|
|||||||
return num1 | num2;
|
return num1 | num2;
|
||||||
}
|
}
|
||||||
public static BigInteger gcd(BigInteger num1, BigInteger num2){
|
public static BigInteger gcd(BigInteger num1, BigInteger num2){
|
||||||
while(!num1.equals(BigInteger.ZERO) && !num2.equals(0)){
|
while(!num1.equals(BigInteger.ZERO) && !num2.equals(BigInteger.ZERO)){
|
||||||
if(num1.compareTo(num2) > 0){
|
if(num1.compareTo(num2) > 0){
|
||||||
num1 = num1.mod(num2);
|
num1 = num1.mod(num2);
|
||||||
}
|
}
|
||||||
@@ -933,7 +932,7 @@ public class Algorithms{
|
|||||||
//Return the arraylist that was built
|
//Return the arraylist that was built
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
public static String swapString(String str, int first, int second){
|
private static String swapString(String str, int first, int second){
|
||||||
char[] tempStr = str.toCharArray();
|
char[] tempStr = str.toCharArray();
|
||||||
char temp = tempStr[first];
|
char temp = tempStr[first];
|
||||||
tempStr[first] = tempStr[second];
|
tempStr[first] = tempStr[second];
|
||||||
|
|||||||
Reference in New Issue
Block a user