mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-04 15:27:36 +08:00
style: include BigIntegerInstantiation
(#5294)
This commit is contained in:
@ -39,7 +39,6 @@ com.thealgorithms.dynamicprogramming.WineProblem=UselessParentheses
|
||||
com.thealgorithms.maths.BinomialCoefficient=UselessParentheses
|
||||
com.thealgorithms.maths.Complex=UselessParentheses
|
||||
com.thealgorithms.maths.DistanceFormulaTest=UnnecessaryFullyQualifiedName
|
||||
com.thealgorithms.maths.FibonacciJavaStreamsTest=BigIntegerInstantiation
|
||||
com.thealgorithms.maths.Gaussian=UselessParentheses
|
||||
com.thealgorithms.maths.GcdSolutionWrapper=UselessParentheses
|
||||
com.thealgorithms.maths.HeronsFormula=UselessParentheses
|
||||
@ -47,7 +46,7 @@ com.thealgorithms.maths.KaprekarNumbers=UselessParentheses
|
||||
com.thealgorithms.maths.KeithNumber=UselessParentheses
|
||||
com.thealgorithms.maths.LeonardoNumber=UselessParentheses
|
||||
com.thealgorithms.maths.LinearDiophantineEquationsSolver=UselessParentheses
|
||||
com.thealgorithms.maths.MatrixUtil=BigIntegerInstantiation,UselessParentheses
|
||||
com.thealgorithms.maths.MatrixUtil=UselessParentheses
|
||||
com.thealgorithms.maths.RomanNumeralUtil=UselessParentheses
|
||||
com.thealgorithms.maths.SecondMinMax=UselessParentheses
|
||||
com.thealgorithms.maths.SecondMinMaxTest=UnnecessaryFullyQualifiedName
|
||||
|
@ -22,7 +22,7 @@ public final class FibonacciJavaStreams {
|
||||
return Optional.of(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
if (index.compareTo(new BigDecimal(2)) < 0) {
|
||||
if (index.compareTo(BigDecimal.TWO) < 0) {
|
||||
return Optional.of(BigDecimal.ONE);
|
||||
}
|
||||
|
||||
|
@ -21,13 +21,13 @@ public class FibonacciJavaStreamsTest {
|
||||
public void testCheckTheFirst4SequenceElements() {
|
||||
checkElement(BigDecimal.ZERO, BigDecimal.ZERO);
|
||||
checkElement(BigDecimal.ONE, BigDecimal.ONE);
|
||||
checkElement(new BigDecimal(2), BigDecimal.ONE);
|
||||
checkElement(new BigDecimal(3), new BigDecimal(2));
|
||||
checkElement(BigDecimal.TWO, BigDecimal.ONE);
|
||||
checkElement(new BigDecimal(3), BigDecimal.TWO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheck10thSequenceElement() {
|
||||
checkElement(new BigDecimal(10), new BigDecimal(55));
|
||||
checkElement(BigDecimal.TEN, new BigDecimal(55));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -11,20 +11,20 @@ class MatrixUtilTest {
|
||||
@Test
|
||||
void add() {
|
||||
final BigDecimal[][] matrix1 = {
|
||||
{new BigDecimal(3), new BigDecimal(2)},
|
||||
{new BigDecimal(3), BigDecimal.TWO},
|
||||
{BigDecimal.ZERO, BigDecimal.ONE},
|
||||
};
|
||||
|
||||
final BigDecimal[][] matrix2 = {
|
||||
{BigDecimal.ONE, new BigDecimal(3)},
|
||||
{new BigDecimal(2), BigDecimal.ZERO},
|
||||
{BigDecimal.TWO, BigDecimal.ZERO},
|
||||
};
|
||||
|
||||
final BigDecimal[][] actual = MatrixUtil.add(matrix1, matrix2).orElseThrow(() -> new AssertionError("Could not compute matrix!"));
|
||||
|
||||
final BigDecimal[][] expected = {
|
||||
{new BigDecimal(4), new BigDecimal(5)},
|
||||
{new BigDecimal(2), BigDecimal.ONE},
|
||||
{BigDecimal.TWO, BigDecimal.ONE},
|
||||
};
|
||||
|
||||
assertTrue(Objects.deepEquals(actual, expected));
|
||||
@ -37,7 +37,7 @@ class MatrixUtilTest {
|
||||
};
|
||||
|
||||
final BigDecimal[][] matrix2 = {
|
||||
{new BigDecimal(2), BigDecimal.ZERO},
|
||||
{BigDecimal.TWO, BigDecimal.ZERO},
|
||||
{new BigDecimal(-2), new BigDecimal(-3)},
|
||||
};
|
||||
|
||||
@ -55,13 +55,13 @@ class MatrixUtilTest {
|
||||
void multiply() {
|
||||
|
||||
final BigDecimal[][] matrix1 = {
|
||||
{BigDecimal.ONE, new BigDecimal(2), new BigDecimal(3)},
|
||||
{BigDecimal.ONE, BigDecimal.TWO, new BigDecimal(3)},
|
||||
{new BigDecimal(4), new BigDecimal(5), new BigDecimal(6)},
|
||||
{new BigDecimal(7), new BigDecimal(8), new BigDecimal(9)},
|
||||
};
|
||||
|
||||
final BigDecimal[][] matrix2 = {
|
||||
{BigDecimal.ONE, new BigDecimal(2)},
|
||||
{BigDecimal.ONE, BigDecimal.TWO},
|
||||
{new BigDecimal(3), new BigDecimal(4)},
|
||||
{new BigDecimal(5), new BigDecimal(6)},
|
||||
};
|
||||
|
Reference in New Issue
Block a user