diff --git a/java-numbers-2/README.md b/core-java-modules/java-numbers-2/README.md
similarity index 100%
rename from java-numbers-2/README.md
rename to core-java-modules/java-numbers-2/README.md
diff --git a/java-numbers-2/pom.xml b/core-java-modules/java-numbers-2/pom.xml
similarity index 90%
rename from java-numbers-2/pom.xml
rename to core-java-modules/java-numbers-2/pom.xml
index 466d040b13..b41348e375 100644
--- a/java-numbers-2/pom.xml
+++ b/core-java-modules/java-numbers-2/pom.xml
@@ -9,10 +9,9 @@
jar
- com.baeldung
- parent-java
+ com.baeldung.core-java-modules
+ core-java-modules
0.0.1-SNAPSHOT
- ../parent-java
diff --git a/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/BigIntegerPrimeChecker.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/BigIntegerPrimeChecker.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/BigIntegerPrimeChecker.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/BigIntegerPrimeChecker.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/BruteForcePrimeChecker.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/BruteForcePrimeChecker.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/BruteForcePrimeChecker.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/BruteForcePrimeChecker.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/OptimisedPrimeChecker.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/OptimisedPrimeChecker.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/OptimisedPrimeChecker.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/OptimisedPrimeChecker.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/PrimeChecker.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/PrimeChecker.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/PrimeChecker.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/PrimeChecker.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/PrimesPrimeChecker.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/PrimesPrimeChecker.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/PrimesPrimeChecker.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/algorithms/primechecker/PrimesPrimeChecker.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/area/circle/Circle.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/area/circle/Circle.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/area/circle/Circle.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/area/circle/Circle.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/area/circle/CircleArea.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/area/circle/CircleArea.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/area/circle/CircleArea.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/area/circle/CircleArea.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/binarynumbers/BinaryNumbers.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/binarynumbers/BinaryNumbers.java
similarity index 96%
rename from java-numbers-2/src/main/java/com/baeldung/binarynumbers/BinaryNumbers.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/binarynumbers/BinaryNumbers.java
index 62cead726f..07d846df4a 100644
--- a/java-numbers-2/src/main/java/com/baeldung/binarynumbers/BinaryNumbers.java
+++ b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/binarynumbers/BinaryNumbers.java
@@ -1,140 +1,140 @@
-package com.baeldung.binarynumbers;
-
-public class BinaryNumbers {
-
- /**
- * This method takes a decimal number and convert it into a binary number.
- * example:- input:10, output:1010
- *
- * @param decimalNumber
- * @return binary number
- */
- public Integer convertDecimalToBinary(Integer decimalNumber) {
-
- if (decimalNumber == 0) {
- return decimalNumber;
- }
-
- StringBuilder binaryNumber = new StringBuilder();
- Integer quotient = decimalNumber;
-
- while (quotient > 0) {
-
- int remainder = quotient % 2;
- binaryNumber.append(remainder);
- quotient /= 2;
- }
-
- binaryNumber = binaryNumber.reverse();
- return Integer.valueOf(binaryNumber.toString());
- }
-
- /**
- * This method takes a binary number and convert it into a decimal number.
- * example:- input:101, output:5
- *
- * @param binary number
- * @return decimal Number
- */
- public Integer convertBinaryToDecimal(Integer binaryNumber) {
-
- Integer decimalNumber = 0;
- Integer base = 1;
-
- while (binaryNumber > 0) {
-
- int lastDigit = binaryNumber % 10;
- binaryNumber = binaryNumber / 10;
-
- decimalNumber += lastDigit * base;
- base = base * 2;
- }
- return decimalNumber;
- }
-
- /**
- * This method accepts two binary numbers and returns sum of input numbers.
- * Example:- firstNum: 101, secondNum: 100, output: 1001
- *
- * @param firstNum
- * @param secondNum
- * @return addition of input numbers
- */
- public Integer addBinaryNumber(Integer firstNum, Integer secondNum) {
-
- StringBuilder output = new StringBuilder();
-
- int carry = 0;
- int temp;
-
- while (firstNum != 0 || secondNum != 0) {
-
- temp = (firstNum % 10 + secondNum % 10 + carry) % 2;
- output.append(temp);
-
- carry = (firstNum % 10 + secondNum % 10 + carry) / 2;
-
- firstNum = firstNum / 10;
- secondNum = secondNum / 10;
- }
-
- if (carry != 0) {
- output.append(carry);
- }
-
- return Integer.valueOf(output.reverse()
- .toString());
- }
-
- /**
- * This method takes two binary number as input and subtract second number from the first number.
- * example:- firstNum: 1000, secondNum: 11, output: 101
- * @param firstNum
- * @param secondNum
- * @return Result of subtraction of secondNum from first
- */
- public Integer substractBinaryNumber(Integer firstNum, Integer secondNum) {
-
- int onesComplement = Integer.valueOf(getOnesComplement(secondNum));
- StringBuilder output = new StringBuilder();
- int carry = 0;
- int temp;
-
- while (firstNum != 0 || onesComplement != 0) {
-
- temp = (firstNum % 10 + onesComplement % 10 + carry) % 2;
- output.append(temp);
-
- carry = (firstNum % 10 + onesComplement % 10 + carry) / 2;
-
- firstNum = firstNum / 10;
- onesComplement = onesComplement / 10;
- }
-
- String additionOfFirstNumAndOnesComplement = output.reverse()
- .toString();
-
- if (carry == 1) {
- return addBinaryNumber(Integer.valueOf(additionOfFirstNumAndOnesComplement), carry);
- } else {
- return getOnesComplement(Integer.valueOf(additionOfFirstNumAndOnesComplement));
- }
- }
-
- public Integer getOnesComplement(Integer num) {
-
- StringBuilder onesComplement = new StringBuilder();
- while (num > 0) {
- int lastDigit = num % 10;
- if (lastDigit == 0) {
- onesComplement.append(1);
- } else {
- onesComplement.append(0);
- }
- num = num / 10;
- }
- return Integer.valueOf(onesComplement.reverse()
- .toString());
- }
-
+package com.baeldung.binarynumbers;
+
+public class BinaryNumbers {
+
+ /**
+ * This method takes a decimal number and convert it into a binary number.
+ * example:- input:10, output:1010
+ *
+ * @param decimalNumber
+ * @return binary number
+ */
+ public Integer convertDecimalToBinary(Integer decimalNumber) {
+
+ if (decimalNumber == 0) {
+ return decimalNumber;
+ }
+
+ StringBuilder binaryNumber = new StringBuilder();
+ Integer quotient = decimalNumber;
+
+ while (quotient > 0) {
+
+ int remainder = quotient % 2;
+ binaryNumber.append(remainder);
+ quotient /= 2;
+ }
+
+ binaryNumber = binaryNumber.reverse();
+ return Integer.valueOf(binaryNumber.toString());
+ }
+
+ /**
+ * This method takes a binary number and convert it into a decimal number.
+ * example:- input:101, output:5
+ *
+ * @param binary number
+ * @return decimal Number
+ */
+ public Integer convertBinaryToDecimal(Integer binaryNumber) {
+
+ Integer decimalNumber = 0;
+ Integer base = 1;
+
+ while (binaryNumber > 0) {
+
+ int lastDigit = binaryNumber % 10;
+ binaryNumber = binaryNumber / 10;
+
+ decimalNumber += lastDigit * base;
+ base = base * 2;
+ }
+ return decimalNumber;
+ }
+
+ /**
+ * This method accepts two binary numbers and returns sum of input numbers.
+ * Example:- firstNum: 101, secondNum: 100, output: 1001
+ *
+ * @param firstNum
+ * @param secondNum
+ * @return addition of input numbers
+ */
+ public Integer addBinaryNumber(Integer firstNum, Integer secondNum) {
+
+ StringBuilder output = new StringBuilder();
+
+ int carry = 0;
+ int temp;
+
+ while (firstNum != 0 || secondNum != 0) {
+
+ temp = (firstNum % 10 + secondNum % 10 + carry) % 2;
+ output.append(temp);
+
+ carry = (firstNum % 10 + secondNum % 10 + carry) / 2;
+
+ firstNum = firstNum / 10;
+ secondNum = secondNum / 10;
+ }
+
+ if (carry != 0) {
+ output.append(carry);
+ }
+
+ return Integer.valueOf(output.reverse()
+ .toString());
+ }
+
+ /**
+ * This method takes two binary number as input and subtract second number from the first number.
+ * example:- firstNum: 1000, secondNum: 11, output: 101
+ * @param firstNum
+ * @param secondNum
+ * @return Result of subtraction of secondNum from first
+ */
+ public Integer substractBinaryNumber(Integer firstNum, Integer secondNum) {
+
+ int onesComplement = Integer.valueOf(getOnesComplement(secondNum));
+ StringBuilder output = new StringBuilder();
+ int carry = 0;
+ int temp;
+
+ while (firstNum != 0 || onesComplement != 0) {
+
+ temp = (firstNum % 10 + onesComplement % 10 + carry) % 2;
+ output.append(temp);
+
+ carry = (firstNum % 10 + onesComplement % 10 + carry) / 2;
+
+ firstNum = firstNum / 10;
+ onesComplement = onesComplement / 10;
+ }
+
+ String additionOfFirstNumAndOnesComplement = output.reverse()
+ .toString();
+
+ if (carry == 1) {
+ return addBinaryNumber(Integer.valueOf(additionOfFirstNumAndOnesComplement), carry);
+ } else {
+ return getOnesComplement(Integer.valueOf(additionOfFirstNumAndOnesComplement));
+ }
+ }
+
+ public Integer getOnesComplement(Integer num) {
+
+ StringBuilder onesComplement = new StringBuilder();
+ while (num > 0) {
+ int lastDigit = num % 10;
+ if (lastDigit == 0) {
+ onesComplement.append(1);
+ } else {
+ onesComplement.append(0);
+ }
+ num = num / 10;
+ }
+ return Integer.valueOf(onesComplement.reverse()
+ .toString());
+ }
+
}
\ No newline at end of file
diff --git a/java-numbers-2/src/main/java/com/baeldung/lcm/BigIntegerLCM.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/lcm/BigIntegerLCM.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/lcm/BigIntegerLCM.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/lcm/BigIntegerLCM.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/lcm/EuclideanAlgorithm.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/lcm/EuclideanAlgorithm.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/lcm/EuclideanAlgorithm.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/lcm/EuclideanAlgorithm.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/lcm/PrimeFactorizationAlgorithm.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/lcm/PrimeFactorizationAlgorithm.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/lcm/PrimeFactorizationAlgorithm.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/lcm/PrimeFactorizationAlgorithm.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/lcm/SimpleAlgorithm.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/lcm/SimpleAlgorithm.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/lcm/SimpleAlgorithm.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/lcm/SimpleAlgorithm.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/nan/NaNExample.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/nan/NaNExample.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/nan/NaNExample.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/nan/NaNExample.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/pow/PowerExample.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/pow/PowerExample.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/pow/PowerExample.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/pow/PowerExample.java
diff --git a/java-numbers-2/src/main/java/com/baeldung/prime/PrimeGenerator.java b/core-java-modules/java-numbers-2/src/main/java/com/baeldung/prime/PrimeGenerator.java
similarity index 100%
rename from java-numbers-2/src/main/java/com/baeldung/prime/PrimeGenerator.java
rename to core-java-modules/java-numbers-2/src/main/java/com/baeldung/prime/PrimeGenerator.java
diff --git a/java-numbers-2/src/test/java/com/baeldung/algorithms/primechecker/PrimeCheckerUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/algorithms/primechecker/PrimeCheckerUnitTest.java
similarity index 100%
rename from java-numbers-2/src/test/java/com/baeldung/algorithms/primechecker/PrimeCheckerUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/algorithms/primechecker/PrimeCheckerUnitTest.java
diff --git a/java-numbers-2/src/test/java/com/baeldung/binarynumbers/BinaryNumbersUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/binarynumbers/BinaryNumbersUnitTest.java
similarity index 96%
rename from java-numbers-2/src/test/java/com/baeldung/binarynumbers/BinaryNumbersUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/binarynumbers/BinaryNumbersUnitTest.java
index ca6022261d..794f58a0a2 100644
--- a/java-numbers-2/src/test/java/com/baeldung/binarynumbers/BinaryNumbersUnitTest.java
+++ b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/binarynumbers/BinaryNumbersUnitTest.java
@@ -1,73 +1,73 @@
-package com.baeldung.binarynumbers;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class BinaryNumbersUnitTest {
-
- private BinaryNumbers binaryNumbers = new BinaryNumbers();
-
- @Test
- public void given_decimalNumber_then_returnBinaryNumber() {
- assertEquals(Integer.valueOf(1000), binaryNumbers.convertDecimalToBinary(8));
- assertEquals(Integer.valueOf(10100), binaryNumbers.convertDecimalToBinary(20));
- }
-
- @Test
- public void given_decimalNumber_then_convertToBinaryNumber() {
- assertEquals("1000", Integer.toBinaryString(8));
- assertEquals("10100", Integer.toBinaryString(20));
- }
-
- @Test
- public void given_binaryNumber_then_ConvertToDecimalNumber() {
- assertEquals(8, Integer.parseInt("1000", 2));
- assertEquals(20, Integer.parseInt("10100", 2));
- }
-
- @Test
- public void given_binaryNumber_then_returnDecimalNumber() {
- assertEquals(Integer.valueOf(8), binaryNumbers.convertBinaryToDecimal(1000));
- assertEquals(Integer.valueOf(20), binaryNumbers.convertBinaryToDecimal(10100));
- }
-
- @Test
- public void given_twoBinaryNumber_then_returnAddition() {
- // adding 4 and 10
- assertEquals(Integer.valueOf(1110), binaryNumbers.addBinaryNumber(100, 1010));
-
- // adding 26 and 14
- assertEquals(Integer.valueOf(101000), binaryNumbers.addBinaryNumber(11010, 1110));
- }
-
- @Test
- public void given_twoBinaryNumber_then_returnSubtraction() {
- // subtracting 16 from 25
- assertEquals(Integer.valueOf(1001), binaryNumbers.substractBinaryNumber(11001, 10000));
-
- // subtracting 29 from 16, the output here is negative
- assertEquals(Integer.valueOf(1101), binaryNumbers.substractBinaryNumber(10000, 11101));
- }
-
- @Test
- public void given_binaryLiteral_thenReturnDecimalValue() {
-
- byte five = 0b101;
- assertEquals((byte) 5, five);
-
- short three = 0b11;
- assertEquals((short) 3, three);
-
- int nine = 0B1001;
- assertEquals(9, nine);
-
- long twentyNine = 0B11101;
- assertEquals(29, twentyNine);
-
- int minusThirtySeven = -0B100101;
- assertEquals(-37, minusThirtySeven);
-
- }
-
-}
+package com.baeldung.binarynumbers;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class BinaryNumbersUnitTest {
+
+ private BinaryNumbers binaryNumbers = new BinaryNumbers();
+
+ @Test
+ public void given_decimalNumber_then_returnBinaryNumber() {
+ assertEquals(Integer.valueOf(1000), binaryNumbers.convertDecimalToBinary(8));
+ assertEquals(Integer.valueOf(10100), binaryNumbers.convertDecimalToBinary(20));
+ }
+
+ @Test
+ public void given_decimalNumber_then_convertToBinaryNumber() {
+ assertEquals("1000", Integer.toBinaryString(8));
+ assertEquals("10100", Integer.toBinaryString(20));
+ }
+
+ @Test
+ public void given_binaryNumber_then_ConvertToDecimalNumber() {
+ assertEquals(8, Integer.parseInt("1000", 2));
+ assertEquals(20, Integer.parseInt("10100", 2));
+ }
+
+ @Test
+ public void given_binaryNumber_then_returnDecimalNumber() {
+ assertEquals(Integer.valueOf(8), binaryNumbers.convertBinaryToDecimal(1000));
+ assertEquals(Integer.valueOf(20), binaryNumbers.convertBinaryToDecimal(10100));
+ }
+
+ @Test
+ public void given_twoBinaryNumber_then_returnAddition() {
+ // adding 4 and 10
+ assertEquals(Integer.valueOf(1110), binaryNumbers.addBinaryNumber(100, 1010));
+
+ // adding 26 and 14
+ assertEquals(Integer.valueOf(101000), binaryNumbers.addBinaryNumber(11010, 1110));
+ }
+
+ @Test
+ public void given_twoBinaryNumber_then_returnSubtraction() {
+ // subtracting 16 from 25
+ assertEquals(Integer.valueOf(1001), binaryNumbers.substractBinaryNumber(11001, 10000));
+
+ // subtracting 29 from 16, the output here is negative
+ assertEquals(Integer.valueOf(1101), binaryNumbers.substractBinaryNumber(10000, 11101));
+ }
+
+ @Test
+ public void given_binaryLiteral_thenReturnDecimalValue() {
+
+ byte five = 0b101;
+ assertEquals((byte) 5, five);
+
+ short three = 0b11;
+ assertEquals((short) 3, three);
+
+ int nine = 0B1001;
+ assertEquals(9, nine);
+
+ long twentyNine = 0B11101;
+ assertEquals(29, twentyNine);
+
+ int minusThirtySeven = -0B100101;
+ assertEquals(-37, minusThirtySeven);
+
+ }
+
+}
diff --git a/java-numbers-2/src/test/java/com/baeldung/java/math/MathUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/java/math/MathUnitTest.java
similarity index 100%
rename from java-numbers-2/src/test/java/com/baeldung/java/math/MathUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/java/math/MathUnitTest.java
diff --git a/java-numbers-2/src/test/java/com/baeldung/lcm/BigIntegerLCMUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/lcm/BigIntegerLCMUnitTest.java
similarity index 100%
rename from java-numbers-2/src/test/java/com/baeldung/lcm/BigIntegerLCMUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/lcm/BigIntegerLCMUnitTest.java
diff --git a/java-numbers-2/src/test/java/com/baeldung/lcm/EuclideanAlgorithmUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/lcm/EuclideanAlgorithmUnitTest.java
similarity index 100%
rename from java-numbers-2/src/test/java/com/baeldung/lcm/EuclideanAlgorithmUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/lcm/EuclideanAlgorithmUnitTest.java
diff --git a/java-numbers-2/src/test/java/com/baeldung/lcm/PrimeFactorizationAlgorithmUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/lcm/PrimeFactorizationAlgorithmUnitTest.java
similarity index 100%
rename from java-numbers-2/src/test/java/com/baeldung/lcm/PrimeFactorizationAlgorithmUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/lcm/PrimeFactorizationAlgorithmUnitTest.java
diff --git a/java-numbers-2/src/test/java/com/baeldung/lcm/SimpleAlgorithmUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/lcm/SimpleAlgorithmUnitTest.java
similarity index 100%
rename from java-numbers-2/src/test/java/com/baeldung/lcm/SimpleAlgorithmUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/lcm/SimpleAlgorithmUnitTest.java
diff --git a/java-numbers-2/src/test/java/com/baeldung/lossyconversion/ConversionTechniquesUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/lossyconversion/ConversionTechniquesUnitTest.java
similarity index 100%
rename from java-numbers-2/src/test/java/com/baeldung/lossyconversion/ConversionTechniquesUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/lossyconversion/ConversionTechniquesUnitTest.java
diff --git a/java-numbers-2/src/test/java/com/baeldung/prime/PrimeGeneratorUnitTest.java b/core-java-modules/java-numbers-2/src/test/java/com/baeldung/prime/PrimeGeneratorUnitTest.java
similarity index 100%
rename from java-numbers-2/src/test/java/com/baeldung/prime/PrimeGeneratorUnitTest.java
rename to core-java-modules/java-numbers-2/src/test/java/com/baeldung/prime/PrimeGeneratorUnitTest.java
diff --git a/java-numbers-3/README.md b/core-java-modules/java-numbers-3/README.md
similarity index 100%
rename from java-numbers-3/README.md
rename to core-java-modules/java-numbers-3/README.md
diff --git a/java-numbers-3/pom.xml b/core-java-modules/java-numbers-3/pom.xml
similarity index 91%
rename from java-numbers-3/pom.xml
rename to core-java-modules/java-numbers-3/pom.xml
index 68c2ac98de..2c2006e303 100644
--- a/java-numbers-3/pom.xml
+++ b/core-java-modules/java-numbers-3/pom.xml
@@ -7,10 +7,9 @@
jar
- com.baeldung
- parent-java
+ com.baeldung.core-java-modules
+ core-java-modules
0.0.1-SNAPSHOT
- ../parent-java
diff --git a/java-numbers-3/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java b/core-java-modules/java-numbers-3/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java
similarity index 100%
rename from java-numbers-3/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java
rename to core-java-modules/java-numbers-3/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java
diff --git a/java-numbers-3/src/main/java/com/baeldung/formatNumber/FormatNumber.java b/core-java-modules/java-numbers-3/src/main/java/com/baeldung/formatNumber/FormatNumber.java
similarity index 100%
rename from java-numbers-3/src/main/java/com/baeldung/formatNumber/FormatNumber.java
rename to core-java-modules/java-numbers-3/src/main/java/com/baeldung/formatNumber/FormatNumber.java
diff --git a/java-numbers-3/src/main/java/com/baeldung/integerToBinary/IntegerToBinary.java b/core-java-modules/java-numbers-3/src/main/java/com/baeldung/integerToBinary/IntegerToBinary.java
similarity index 100%
rename from java-numbers-3/src/main/java/com/baeldung/integerToBinary/IntegerToBinary.java
rename to core-java-modules/java-numbers-3/src/main/java/com/baeldung/integerToBinary/IntegerToBinary.java
diff --git a/java-numbers-3/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java b/core-java-modules/java-numbers-3/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java
similarity index 100%
rename from java-numbers-3/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java
rename to core-java-modules/java-numbers-3/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java
diff --git a/java-numbers-3/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java b/core-java-modules/java-numbers-3/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java
similarity index 100%
rename from java-numbers-3/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java
rename to core-java-modules/java-numbers-3/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java
diff --git a/java-numbers-3/src/main/java/com/baeldung/randomnumbers/RandomNumbersGenerator.java b/core-java-modules/java-numbers-3/src/main/java/com/baeldung/randomnumbers/RandomNumbersGenerator.java
similarity index 100%
rename from java-numbers-3/src/main/java/com/baeldung/randomnumbers/RandomNumbersGenerator.java
rename to core-java-modules/java-numbers-3/src/main/java/com/baeldung/randomnumbers/RandomNumbersGenerator.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/abstractnumber/AbstractNumberUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/abstractnumber/AbstractNumberUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/abstractnumber/AbstractNumberUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/abstractnumber/AbstractNumberUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/divisionbyzero/DivisionByZeroUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/divisionbyzero/DivisionByZeroUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/divisionbyzero/DivisionByZeroUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/divisionbyzero/DivisionByZeroUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/formatNumber/FormatNumberUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/formatNumber/FormatNumberUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/formatNumber/FormatNumberUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/formatNumber/FormatNumberUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/integerToBinary/IntegerToBinaryUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/integerToBinary/IntegerToBinaryUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/integerToBinary/IntegerToBinaryUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/integerToBinary/IntegerToBinaryUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/parsedouble/StringToDoubleParserUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/parsedouble/StringToDoubleParserUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/parsedouble/StringToDoubleParserUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/parsedouble/StringToDoubleParserUnitTest.java
diff --git a/java-numbers-3/src/test/java/com/baeldung/randomnumbers/RandomNumbersGeneratorUnitTest.java b/core-java-modules/java-numbers-3/src/test/java/com/baeldung/randomnumbers/RandomNumbersGeneratorUnitTest.java
similarity index 100%
rename from java-numbers-3/src/test/java/com/baeldung/randomnumbers/RandomNumbersGeneratorUnitTest.java
rename to core-java-modules/java-numbers-3/src/test/java/com/baeldung/randomnumbers/RandomNumbersGeneratorUnitTest.java
diff --git a/java-numbers-4/README.md b/core-java-modules/java-numbers-4/README.md
similarity index 100%
rename from java-numbers-4/README.md
rename to core-java-modules/java-numbers-4/README.md
diff --git a/java-numbers-4/pom.xml b/core-java-modules/java-numbers-4/pom.xml
similarity index 90%
rename from java-numbers-4/pom.xml
rename to core-java-modules/java-numbers-4/pom.xml
index 4750b58511..b3ecb3be42 100644
--- a/java-numbers-4/pom.xml
+++ b/core-java-modules/java-numbers-4/pom.xml
@@ -7,10 +7,9 @@
jar
- com.baeldung
- parent-java
+ com.baeldung.core-java-modules
+ core-java-modules
0.0.1-SNAPSHOT
- ../parent-java
diff --git a/java-numbers-4/src/main/java/com/baeldung/automorphicnumber/AutomorphicNumber.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/automorphicnumber/AutomorphicNumber.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/automorphicnumber/AutomorphicNumber.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/automorphicnumber/AutomorphicNumber.java
diff --git a/java-numbers-4/src/main/java/com/baeldung/booleantoint/BooleanToInt.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/booleantoint/BooleanToInt.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/booleantoint/BooleanToInt.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/booleantoint/BooleanToInt.java
diff --git a/java-numbers-4/src/main/java/com/baeldung/convertLongToInt/ConvertLongToInt.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/convertLongToInt/ConvertLongToInt.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/convertLongToInt/ConvertLongToInt.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/convertLongToInt/ConvertLongToInt.java
diff --git a/java-numbers-4/src/main/java/com/baeldung/humanreadablebytes/FileSizeFormatUtil.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/humanreadablebytes/FileSizeFormatUtil.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/humanreadablebytes/FileSizeFormatUtil.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/humanreadablebytes/FileSizeFormatUtil.java
diff --git a/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java
diff --git a/java-numbers-4/src/main/java/com/baeldung/perfectsquare/PerfectSquareUtil.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/perfectsquare/PerfectSquareUtil.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/perfectsquare/PerfectSquareUtil.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/perfectsquare/PerfectSquareUtil.java
diff --git a/java-numbers-4/src/main/java/com/baeldung/probability/MaleHeightGenerator.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/probability/MaleHeightGenerator.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/probability/MaleHeightGenerator.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/probability/MaleHeightGenerator.java
diff --git a/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java
diff --git a/java-numbers-4/src/main/java/com/baeldung/reversenumber/ReverseNumber.java b/core-java-modules/java-numbers-4/src/main/java/com/baeldung/reversenumber/ReverseNumber.java
similarity index 100%
rename from java-numbers-4/src/main/java/com/baeldung/reversenumber/ReverseNumber.java
rename to core-java-modules/java-numbers-4/src/main/java/com/baeldung/reversenumber/ReverseNumber.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/automorphicnumber/AutomorphicNumberUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/automorphicnumber/AutomorphicNumberUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/automorphicnumber/AutomorphicNumberUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/automorphicnumber/AutomorphicNumberUnitTest.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/biginteger/BigIntegerUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/biginteger/BigIntegerUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/biginteger/BigIntegerUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/biginteger/BigIntegerUnitTest.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/booleantoint/BooleanToIntUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/booleantoint/BooleanToIntUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/booleantoint/BooleanToIntUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/booleantoint/BooleanToIntUnitTest.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/convertLongToInt/ConvertLongToIntUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/convertLongToInt/ConvertLongToIntUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/convertLongToInt/ConvertLongToIntUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/convertLongToInt/ConvertLongToIntUnitTest.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/humanreadablebytes/FileSizeFormatUtilUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/humanreadablebytes/FileSizeFormatUtilUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/humanreadablebytes/FileSizeFormatUtilUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/humanreadablebytes/FileSizeFormatUtilUnitTest.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/perfectsquare/PerfectSquareUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/perfectsquare/PerfectSquareUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/perfectsquare/PerfectSquareUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/perfectsquare/PerfectSquareUnitTest.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java
diff --git a/java-numbers-4/src/test/java/com/baeldung/reversenumber/ReverseNumberUnitTest.java b/core-java-modules/java-numbers-4/src/test/java/com/baeldung/reversenumber/ReverseNumberUnitTest.java
similarity index 100%
rename from java-numbers-4/src/test/java/com/baeldung/reversenumber/ReverseNumberUnitTest.java
rename to core-java-modules/java-numbers-4/src/test/java/com/baeldung/reversenumber/ReverseNumberUnitTest.java
diff --git a/java-numbers/.gitignore b/core-java-modules/java-numbers/.gitignore
similarity index 100%
rename from java-numbers/.gitignore
rename to core-java-modules/java-numbers/.gitignore
diff --git a/java-numbers/README.md b/core-java-modules/java-numbers/README.md
similarity index 100%
rename from java-numbers/README.md
rename to core-java-modules/java-numbers/README.md
diff --git a/java-numbers/pom.xml b/core-java-modules/java-numbers/pom.xml
similarity index 91%
rename from java-numbers/pom.xml
rename to core-java-modules/java-numbers/pom.xml
index c06bc48c5d..9bd0f33a85 100644
--- a/java-numbers/pom.xml
+++ b/core-java-modules/java-numbers/pom.xml
@@ -9,10 +9,9 @@
jar
- com.baeldung
- parent-java
+ com.baeldung.core-java-modules
+ core-java-modules
0.0.1-SNAPSHOT
- ../parent-java
diff --git a/java-numbers/src/main/java/com/baeldung/maths/BigDecimalDemo.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/maths/BigDecimalDemo.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/maths/BigDecimalDemo.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/maths/BigDecimalDemo.java
diff --git a/java-numbers/src/main/java/com/baeldung/maths/FloatingPointArithmetic.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/maths/FloatingPointArithmetic.java
similarity index 96%
rename from java-numbers/src/main/java/com/baeldung/maths/FloatingPointArithmetic.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/maths/FloatingPointArithmetic.java
index 4163adcf09..aa1aa57339 100644
--- a/java-numbers/src/main/java/com/baeldung/maths/FloatingPointArithmetic.java
+++ b/core-java-modules/java-numbers/src/main/java/com/baeldung/maths/FloatingPointArithmetic.java
@@ -1,51 +1,51 @@
-package com.baeldung.maths;
-
-import java.math.BigDecimal;
-
-public class FloatingPointArithmetic {
- public static void main(String[] args) {
-
- double a = 13.22;
- double b = 4.88;
- double c = 21.45;
-
- System.out.println("a = " + a);
- System.out.println("b = " + b);
- System.out.println("c = " + c);
-
- double sum_ab = a + b;
- System.out.println("a + b = " + sum_ab);
-
- double abc = a + b + c;
- System.out.println("a + b + c = " + abc);
-
- double ab_c = sum_ab + c;
- System.out.println("ab + c = " + ab_c);
-
- double sum_ac = a + c;
- System.out.println("a + c = " + sum_ac);
-
- double acb = a + c + b;
- System.out.println("a + c + b = " + acb);
-
- double ac_b = sum_ac + b;
- System.out.println("ac + b = " + ac_b);
-
- double ab = 18.1;
- double ac = 34.67;
- double sum_ab_c = ab + c;
- double sum_ac_b = ac + b;
- System.out.println("ab + c = " + sum_ab_c);
- System.out.println("ac + b = " + sum_ac_b);
-
- BigDecimal d = new BigDecimal(String.valueOf(a));
- BigDecimal e = new BigDecimal(String.valueOf(b));
- BigDecimal f = new BigDecimal(String.valueOf(c));
-
- BigDecimal def = d.add(e).add(f);
- BigDecimal dfe = d.add(f).add(e);
-
- System.out.println("d + e + f = " + def);
- System.out.println("d + f + e = " + dfe);
- }
-}
+package com.baeldung.maths;
+
+import java.math.BigDecimal;
+
+public class FloatingPointArithmetic {
+ public static void main(String[] args) {
+
+ double a = 13.22;
+ double b = 4.88;
+ double c = 21.45;
+
+ System.out.println("a = " + a);
+ System.out.println("b = " + b);
+ System.out.println("c = " + c);
+
+ double sum_ab = a + b;
+ System.out.println("a + b = " + sum_ab);
+
+ double abc = a + b + c;
+ System.out.println("a + b + c = " + abc);
+
+ double ab_c = sum_ab + c;
+ System.out.println("ab + c = " + ab_c);
+
+ double sum_ac = a + c;
+ System.out.println("a + c = " + sum_ac);
+
+ double acb = a + c + b;
+ System.out.println("a + c + b = " + acb);
+
+ double ac_b = sum_ac + b;
+ System.out.println("ac + b = " + ac_b);
+
+ double ab = 18.1;
+ double ac = 34.67;
+ double sum_ab_c = ab + c;
+ double sum_ac_b = ac + b;
+ System.out.println("ab + c = " + sum_ab_c);
+ System.out.println("ac + b = " + sum_ac_b);
+
+ BigDecimal d = new BigDecimal(String.valueOf(a));
+ BigDecimal e = new BigDecimal(String.valueOf(b));
+ BigDecimal f = new BigDecimal(String.valueOf(c));
+
+ BigDecimal def = d.add(e).add(f);
+ BigDecimal dfe = d.add(f).add(e);
+
+ System.out.println("d + e + f = " + def);
+ System.out.println("d + f + e = " + dfe);
+ }
+}
diff --git a/java-numbers/src/main/java/com/baeldung/maths/Round.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/maths/Round.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/maths/Round.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/maths/Round.java
diff --git a/java-numbers/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/nth/root/calculator/NthRootCalculator.java
diff --git a/java-numbers/src/main/java/com/baeldung/nth/root/main/Main.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/nth/root/main/Main.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/nth/root/main/Main.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/nth/root/main/Main.java
diff --git a/java-numbers/src/main/java/com/baeldung/numberofdigits/Benchmarking.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/Benchmarking.java
old mode 100755
new mode 100644
similarity index 97%
rename from java-numbers/src/main/java/com/baeldung/numberofdigits/Benchmarking.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/Benchmarking.java
index 737654ccf5..b12e6141f7
--- a/java-numbers/src/main/java/com/baeldung/numberofdigits/Benchmarking.java
+++ b/core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/Benchmarking.java
@@ -1,67 +1,67 @@
-package com.baeldung.numberofdigits;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.runner.RunnerException;
-
-public class Benchmarking {
- public static void main(String[] args) throws RunnerException, IOException {
- org.openjdk.jmh.Main.main(args);
- }
-
- @State(Scope.Thread)
- public static class ExecutionPlan {
- public int number = Integer.MAX_VALUE;
- public int length = 0;
- public NumberOfDigits numberOfDigits= new NumberOfDigits();
- }
-
- @Benchmark
- @BenchmarkMode(Mode.AverageTime)
- @OutputTimeUnit(TimeUnit.NANOSECONDS)
- public void stringBasedSolution(ExecutionPlan plan) {
- plan.length = plan.numberOfDigits.stringBasedSolution(plan.number);
- }
-
- @Benchmark
- @BenchmarkMode(Mode.AverageTime)
- @OutputTimeUnit(TimeUnit.NANOSECONDS)
- public void logarithmicApproach(ExecutionPlan plan) {
- plan.length = plan.numberOfDigits.logarithmicApproach(plan.number);
- }
-
- @Benchmark
- @BenchmarkMode(Mode.AverageTime)
- @OutputTimeUnit(TimeUnit.NANOSECONDS)
- public void repeatedMultiplication(ExecutionPlan plan) {
- plan.length = plan.numberOfDigits.repeatedMultiplication(plan.number);
- }
-
- @Benchmark
- @BenchmarkMode(Mode.AverageTime)
- @OutputTimeUnit(TimeUnit.NANOSECONDS)
- public void shiftOperators(ExecutionPlan plan) {
- plan.length = plan.numberOfDigits.shiftOperators(plan.number);
- }
-
- @Benchmark
- @BenchmarkMode(Mode.AverageTime)
- @OutputTimeUnit(TimeUnit.NANOSECONDS)
- public void dividingWithPowersOf2(ExecutionPlan plan) {
- plan.length = plan.numberOfDigits.dividingWithPowersOf2(plan.number);
- }
-
- @Benchmark
- @BenchmarkMode(Mode.AverageTime)
- @OutputTimeUnit(TimeUnit.NANOSECONDS)
- public void divideAndConquer(ExecutionPlan plan) {
- plan.length = plan.numberOfDigits.divideAndConquer(plan.number);
- }
-}
+package com.baeldung.numberofdigits;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.runner.RunnerException;
+
+public class Benchmarking {
+ public static void main(String[] args) throws RunnerException, IOException {
+ org.openjdk.jmh.Main.main(args);
+ }
+
+ @State(Scope.Thread)
+ public static class ExecutionPlan {
+ public int number = Integer.MAX_VALUE;
+ public int length = 0;
+ public NumberOfDigits numberOfDigits= new NumberOfDigits();
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ @OutputTimeUnit(TimeUnit.NANOSECONDS)
+ public void stringBasedSolution(ExecutionPlan plan) {
+ plan.length = plan.numberOfDigits.stringBasedSolution(plan.number);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ @OutputTimeUnit(TimeUnit.NANOSECONDS)
+ public void logarithmicApproach(ExecutionPlan plan) {
+ plan.length = plan.numberOfDigits.logarithmicApproach(plan.number);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ @OutputTimeUnit(TimeUnit.NANOSECONDS)
+ public void repeatedMultiplication(ExecutionPlan plan) {
+ plan.length = plan.numberOfDigits.repeatedMultiplication(plan.number);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ @OutputTimeUnit(TimeUnit.NANOSECONDS)
+ public void shiftOperators(ExecutionPlan plan) {
+ plan.length = plan.numberOfDigits.shiftOperators(plan.number);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ @OutputTimeUnit(TimeUnit.NANOSECONDS)
+ public void dividingWithPowersOf2(ExecutionPlan plan) {
+ plan.length = plan.numberOfDigits.dividingWithPowersOf2(plan.number);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ @OutputTimeUnit(TimeUnit.NANOSECONDS)
+ public void divideAndConquer(ExecutionPlan plan) {
+ plan.length = plan.numberOfDigits.divideAndConquer(plan.number);
+ }
+}
diff --git a/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java
old mode 100755
new mode 100644
similarity index 96%
rename from java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java
index 1abf74d405..80f6b6c5c5
--- a/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java
+++ b/core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java
@@ -1,97 +1,97 @@
-package com.baeldung.numberofdigits;
-
-public class NumberOfDigits {
- public int stringBasedSolution(int number) {
- int length = String.valueOf(number).length();
- return length;
- }
-
- public int logarithmicApproach(int number) {
- int length = (int) Math.log10(number) + 1;
- return length;
- }
-
- public int repeatedMultiplication(int number) {
- int length = 0;
- long temp = 1;
- while(temp <= number) {
- length++;
- temp *= 10;
- }
- return length;
- }
-
- public int shiftOperators(int number) {
- int length = 0;
- long temp = 1;
- while(temp <= number) {
- length++;
- temp = (temp << 3) + (temp << 1);
- }
- return length;
- }
-
- public int dividingWithPowersOf2(int number) {
- int length = 1;
- if (number >= 100000000) {
- length += 8;
- number /= 100000000;
- }
- if (number >= 10000) {
- length += 4;
- number /= 10000;
- }
- if (number >= 100) {
- length += 2;
- number /= 100;
- }
- if (number >= 10) {
- length += 1;
- }
- return length;
- }
-
- public int divideAndConquer(int number) {
- if (number < 100000){
- // 5 digits or less
- if (number < 100){
- // 1 or 2
- if (number < 10)
- return 1;
- else
- return 2;
- }else{
- // 3 to 5 digits
- if (number < 1000)
- return 3;
- else{
- // 4 or 5 digits
- if (number < 10000)
- return 4;
- else
- return 5;
- }
- }
- } else {
- // 6 digits or more
- if (number < 10000000) {
- // 6 or 7 digits
- if (number < 1000000)
- return 6;
- else
- return 7;
- } else {
- // 8 to 10 digits
- if (number < 100000000)
- return 8;
- else {
- // 9 or 10 digits
- if (number < 1000000000)
- return 9;
- else
- return 10;
- }
- }
- }
- }
-}
+package com.baeldung.numberofdigits;
+
+public class NumberOfDigits {
+ public int stringBasedSolution(int number) {
+ int length = String.valueOf(number).length();
+ return length;
+ }
+
+ public int logarithmicApproach(int number) {
+ int length = (int) Math.log10(number) + 1;
+ return length;
+ }
+
+ public int repeatedMultiplication(int number) {
+ int length = 0;
+ long temp = 1;
+ while(temp <= number) {
+ length++;
+ temp *= 10;
+ }
+ return length;
+ }
+
+ public int shiftOperators(int number) {
+ int length = 0;
+ long temp = 1;
+ while(temp <= number) {
+ length++;
+ temp = (temp << 3) + (temp << 1);
+ }
+ return length;
+ }
+
+ public int dividingWithPowersOf2(int number) {
+ int length = 1;
+ if (number >= 100000000) {
+ length += 8;
+ number /= 100000000;
+ }
+ if (number >= 10000) {
+ length += 4;
+ number /= 10000;
+ }
+ if (number >= 100) {
+ length += 2;
+ number /= 100;
+ }
+ if (number >= 10) {
+ length += 1;
+ }
+ return length;
+ }
+
+ public int divideAndConquer(int number) {
+ if (number < 100000){
+ // 5 digits or less
+ if (number < 100){
+ // 1 or 2
+ if (number < 10)
+ return 1;
+ else
+ return 2;
+ }else{
+ // 3 to 5 digits
+ if (number < 1000)
+ return 3;
+ else{
+ // 4 or 5 digits
+ if (number < 10000)
+ return 4;
+ else
+ return 5;
+ }
+ }
+ } else {
+ // 6 digits or more
+ if (number < 10000000) {
+ // 6 or 7 digits
+ if (number < 1000000)
+ return 6;
+ else
+ return 7;
+ } else {
+ // 8 to 10 digits
+ if (number < 100000000)
+ return 8;
+ else {
+ // 9 or 10 digits
+ if (number < 1000000000)
+ return 9;
+ else
+ return 10;
+ }
+ }
+ }
+ }
+}
diff --git a/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java
old mode 100755
new mode 100644
similarity index 96%
rename from java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java
index 4f98992e98..bdb1693724
--- a/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java
+++ b/core-java-modules/java-numbers/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java
@@ -1,35 +1,35 @@
-package com.baeldung.numberofdigits;
-
-import org.apache.log4j.Logger;
-
-public class NumberOfDigitsDriver {
- private static NumberOfDigits numberOfDigits;
-
- private static Logger LOG = Logger.getLogger(NumberOfDigitsDriver.class);
-
- static {
- numberOfDigits = new NumberOfDigits();
- }
-
- public static void main(String[] args) {
- LOG.info("Testing all methods...");
-
- long length = numberOfDigits.stringBasedSolution(602);
- LOG.info("String Based Solution : " + length);
-
- length = numberOfDigits.logarithmicApproach(602);
- LOG.info("Logarithmic Approach : " + length);
-
- length = numberOfDigits.repeatedMultiplication(602);
- LOG.info("Repeated Multiplication : " + length);
-
- length = numberOfDigits.shiftOperators(602);
- LOG.info("Shift Operators : " + length);
-
- length = numberOfDigits.dividingWithPowersOf2(602);
- LOG.info("Dividing with Powers of 2 : " + length);
-
- length = numberOfDigits.divideAndConquer(602);
- LOG.info("Divide And Conquer : " + length);
- }
+package com.baeldung.numberofdigits;
+
+import org.apache.log4j.Logger;
+
+public class NumberOfDigitsDriver {
+ private static NumberOfDigits numberOfDigits;
+
+ private static Logger LOG = Logger.getLogger(NumberOfDigitsDriver.class);
+
+ static {
+ numberOfDigits = new NumberOfDigits();
+ }
+
+ public static void main(String[] args) {
+ LOG.info("Testing all methods...");
+
+ long length = numberOfDigits.stringBasedSolution(602);
+ LOG.info("String Based Solution : " + length);
+
+ length = numberOfDigits.logarithmicApproach(602);
+ LOG.info("Logarithmic Approach : " + length);
+
+ length = numberOfDigits.repeatedMultiplication(602);
+ LOG.info("Repeated Multiplication : " + length);
+
+ length = numberOfDigits.shiftOperators(602);
+ LOG.info("Shift Operators : " + length);
+
+ length = numberOfDigits.dividingWithPowersOf2(602);
+ LOG.info("Dividing with Powers of 2 : " + length);
+
+ length = numberOfDigits.divideAndConquer(602);
+ LOG.info("Divide And Conquer : " + length);
+ }
}
\ No newline at end of file
diff --git a/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/DifferentPairs.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/DifferentPairs.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/pairsaddupnumber/DifferentPairs.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/DifferentPairs.java
diff --git a/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/ExistingPairs.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/ExistingPairs.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/pairsaddupnumber/ExistingPairs.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/ExistingPairs.java
diff --git a/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/FindPairs.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/FindPairs.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/pairsaddupnumber/FindPairs.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/pairsaddupnumber/FindPairs.java
diff --git a/java-numbers/src/main/java/com/baeldung/random/SecureRandomDemo.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/random/SecureRandomDemo.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/random/SecureRandomDemo.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/random/SecureRandomDemo.java
diff --git a/java-numbers/src/main/java/com/baeldung/string/DoubleToString.java b/core-java-modules/java-numbers/src/main/java/com/baeldung/string/DoubleToString.java
similarity index 100%
rename from java-numbers/src/main/java/com/baeldung/string/DoubleToString.java
rename to core-java-modules/java-numbers/src/main/java/com/baeldung/string/DoubleToString.java
diff --git a/java-numbers/src/main/resources/log4j.properties b/core-java-modules/java-numbers/src/main/resources/log4j.properties
similarity index 100%
rename from java-numbers/src/main/resources/log4j.properties
rename to core-java-modules/java-numbers/src/main/resources/log4j.properties
diff --git a/java-numbers/src/main/resources/logback.xml b/core-java-modules/java-numbers/src/main/resources/logback.xml
similarity index 100%
rename from java-numbers/src/main/resources/logback.xml
rename to core-java-modules/java-numbers/src/main/resources/logback.xml
diff --git a/java-numbers/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/decimalformat/DecimalFormatExamplesUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/maths/BigDecimalDemoUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigDecimalDemoUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/maths/BigDecimalDemoUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigDecimalDemoUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/maths/BigDecimalImplUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigDecimalImplUnitTest.java
similarity index 96%
rename from java-numbers/src/test/java/com/baeldung/maths/BigDecimalImplUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigDecimalImplUnitTest.java
index 786e5af312..b6799ce0d8 100644
--- a/java-numbers/src/test/java/com/baeldung/maths/BigDecimalImplUnitTest.java
+++ b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigDecimalImplUnitTest.java
@@ -1,25 +1,25 @@
-package com.baeldung.maths;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-
-public class BigDecimalImplUnitTest {
-
- @Test
- public void givenBigDecimalNumbers_whenAddedTogether_thenGetExpectedResult() {
- BigDecimal serviceTax = new BigDecimal("56.0084578639");
- serviceTax = serviceTax.setScale(2, RoundingMode.CEILING);
-
- BigDecimal entertainmentTax = new BigDecimal("23.00689");
- entertainmentTax = entertainmentTax.setScale(2, RoundingMode.FLOOR);
-
- BigDecimal totalTax = serviceTax.add(entertainmentTax);
- BigDecimal result = BigDecimal.valueOf(79.01);
-
- Assert.assertEquals(result, totalTax);
-
- }
-}
+package com.baeldung.maths;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+public class BigDecimalImplUnitTest {
+
+ @Test
+ public void givenBigDecimalNumbers_whenAddedTogether_thenGetExpectedResult() {
+ BigDecimal serviceTax = new BigDecimal("56.0084578639");
+ serviceTax = serviceTax.setScale(2, RoundingMode.CEILING);
+
+ BigDecimal entertainmentTax = new BigDecimal("23.00689");
+ entertainmentTax = entertainmentTax.setScale(2, RoundingMode.FLOOR);
+
+ BigDecimal totalTax = serviceTax.add(entertainmentTax);
+ BigDecimal result = BigDecimal.valueOf(79.01);
+
+ Assert.assertEquals(result, totalTax);
+
+ }
+}
diff --git a/java-numbers/src/test/java/com/baeldung/maths/BigIntegerDemoUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigIntegerDemoUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/maths/BigIntegerDemoUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigIntegerDemoUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/maths/BigIntegerImplUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigIntegerImplUnitTest.java
similarity index 96%
rename from java-numbers/src/test/java/com/baeldung/maths/BigIntegerImplUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigIntegerImplUnitTest.java
index 4c45f69090..9a9ac963e0 100644
--- a/java-numbers/src/test/java/com/baeldung/maths/BigIntegerImplUnitTest.java
+++ b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/BigIntegerImplUnitTest.java
@@ -1,21 +1,21 @@
-package com.baeldung.maths;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.math.BigInteger;
-
-public class BigIntegerImplUnitTest {
-
- @Test
- public void givenBigIntegerNumbers_whenAddedTogether_thenGetExpectedResult() {
- BigInteger numStarsMilkyWay = new BigInteger("8731409320171337804361260816606476");
- BigInteger numStarsAndromeda = new BigInteger("5379309320171337804361260816606476");
-
- BigInteger totalStars = numStarsMilkyWay.add(numStarsAndromeda);
- BigInteger result = new BigInteger("14110718640342675608722521633212952");
-
- Assert.assertEquals(result, totalStars);
- }
-
-}
+package com.baeldung.maths;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.math.BigInteger;
+
+public class BigIntegerImplUnitTest {
+
+ @Test
+ public void givenBigIntegerNumbers_whenAddedTogether_thenGetExpectedResult() {
+ BigInteger numStarsMilkyWay = new BigInteger("8731409320171337804361260816606476");
+ BigInteger numStarsAndromeda = new BigInteger("5379309320171337804361260816606476");
+
+ BigInteger totalStars = numStarsMilkyWay.add(numStarsAndromeda);
+ BigInteger result = new BigInteger("14110718640342675608722521633212952");
+
+ Assert.assertEquals(result, totalStars);
+ }
+
+}
diff --git a/java-numbers/src/test/java/com/baeldung/maths/FloatingPointArithmeticUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/FloatingPointArithmeticUnitTest.java
similarity index 96%
rename from java-numbers/src/test/java/com/baeldung/maths/FloatingPointArithmeticUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/maths/FloatingPointArithmeticUnitTest.java
index 6812a8f588..bbd06dbf75 100644
--- a/java-numbers/src/test/java/com/baeldung/maths/FloatingPointArithmeticUnitTest.java
+++ b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/FloatingPointArithmeticUnitTest.java
@@ -1,45 +1,45 @@
-package com.baeldung.maths;
-
-import java.math.BigDecimal;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class FloatingPointArithmeticUnitTest {
-
- @Test
- public void givenDecimalNumbers_whenAddedTogether_thenGetExpectedResult() {
- double a = 13.22;
- double b = 4.88;
- double c = 21.45;
- double result = 39.55;
-
- double abc = a + b + c;
- double acb = a + c + b;
-
- Assert.assertEquals(result, abc, 0);
- Assert.assertNotEquals(result, acb, 0);
-
- double ab = 18.1;
- double ac = 34.67;
-
- double ab_c = ab + c;
- double ac_b = ac + b;
-
- Assert.assertEquals(result, ab_c, 0);
- Assert.assertNotEquals(result, ac_b, 0);
-
- BigDecimal d = new BigDecimal(String.valueOf(a));
- BigDecimal e = new BigDecimal(String.valueOf(b));
- BigDecimal f = new BigDecimal(String.valueOf(c));
- BigDecimal sum = new BigDecimal("39.55");
-
- BigDecimal def = d.add(e).add(f);
- BigDecimal dfe = d.add(f).add(e);
-
- Assert.assertEquals(0, def.compareTo(sum));
- Assert.assertEquals(0, dfe.compareTo(sum));
-
- Assert.assertNotEquals(0, sum.compareTo(new BigDecimal(String.valueOf(acb))));
- }
-}
+package com.baeldung.maths;
+
+import java.math.BigDecimal;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FloatingPointArithmeticUnitTest {
+
+ @Test
+ public void givenDecimalNumbers_whenAddedTogether_thenGetExpectedResult() {
+ double a = 13.22;
+ double b = 4.88;
+ double c = 21.45;
+ double result = 39.55;
+
+ double abc = a + b + c;
+ double acb = a + c + b;
+
+ Assert.assertEquals(result, abc, 0);
+ Assert.assertNotEquals(result, acb, 0);
+
+ double ab = 18.1;
+ double ac = 34.67;
+
+ double ab_c = ab + c;
+ double ac_b = ac + b;
+
+ Assert.assertEquals(result, ab_c, 0);
+ Assert.assertNotEquals(result, ac_b, 0);
+
+ BigDecimal d = new BigDecimal(String.valueOf(a));
+ BigDecimal e = new BigDecimal(String.valueOf(b));
+ BigDecimal f = new BigDecimal(String.valueOf(c));
+ BigDecimal sum = new BigDecimal("39.55");
+
+ BigDecimal def = d.add(e).add(f);
+ BigDecimal dfe = d.add(f).add(e);
+
+ Assert.assertEquals(0, def.compareTo(sum));
+ Assert.assertEquals(0, dfe.compareTo(sum));
+
+ Assert.assertNotEquals(0, sum.compareTo(new BigDecimal(String.valueOf(acb))));
+ }
+}
diff --git a/java-numbers/src/test/java/com/baeldung/maths/MathSinUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/MathSinUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/maths/MathSinUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/maths/MathSinUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/maths/RoundUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/RoundUnitTest.java
similarity index 98%
rename from java-numbers/src/test/java/com/baeldung/maths/RoundUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/maths/RoundUnitTest.java
index 7e3f5d6c63..19f4797e91 100644
--- a/java-numbers/src/test/java/com/baeldung/maths/RoundUnitTest.java
+++ b/core-java-modules/java-numbers/src/test/java/com/baeldung/maths/RoundUnitTest.java
@@ -1,71 +1,71 @@
-package com.baeldung.maths;
-
-import org.apache.commons.math3.util.Precision;
-import org.decimal4j.util.DoubleRounder;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class RoundUnitTest {
- private double value = 2.03456d;
- private int places = 2;
- private double delta = 0.0d;
- private double expected = 2.03d;
-
- @Test
- public void givenDecimalNumber_whenRoundToNDecimalPlaces_thenGetExpectedResult() {
- Assert.assertEquals(expected, Round.round(value, places), delta);
- Assert.assertEquals(expected, Round.roundNotPrecise(value, places), delta);
- Assert.assertEquals(expected, Round.roundAvoid(value, places), delta);
- Assert.assertEquals(expected, Precision.round(value, places), delta);
- Assert.assertEquals(expected, DoubleRounder.round(value, places), delta);
-
- places = 3;
- expected = 2.035d;
-
- Assert.assertEquals(expected, Round.round(value, places), delta);
- Assert.assertEquals(expected, Round.roundNotPrecise(value, places), delta);
- Assert.assertEquals(expected, Round.roundAvoid(value, places), delta);
- Assert.assertEquals(expected, Precision.round(value, places), delta);
- Assert.assertEquals(expected, DoubleRounder.round(value, places), delta);
-
- value = 1000.0d;
- places = 17;
- expected = 1000.0d;
-
- Assert.assertEquals(expected, Round.round(value, places), delta);
- Assert.assertEquals(expected, Round.roundNotPrecise(value, places), delta);
- Assert.assertNotEquals(expected, Round.roundAvoid(value, places), delta); // Returns: 92.23372036854776 !
- Assert.assertEquals(expected, Precision.round(value, places), delta);
- Assert.assertEquals(expected, DoubleRounder.round(value, places), delta);
-
- value = 256.025d;
- places = 2;
- expected = 256.03d;
-
- Assert.assertEquals(expected, Round.round(value, places), delta);
- Assert.assertNotEquals(expected, Round.roundNotPrecise(value, places), delta); // Returns: 256.02 !
- Assert.assertNotEquals(expected, Round.roundAvoid(value, places), delta); // Returns: 256.02 !
- Assert.assertEquals(expected, Precision.round(value, places), delta);
- Assert.assertNotEquals(expected, DoubleRounder.round(value, places), delta); // Returns: 256.02 !
-
- value = 260.775d;
- places = 2;
- expected = 260.78d;
-
- Assert.assertEquals(expected, Round.round(value, places), delta);
- Assert.assertNotEquals(expected, Round.roundNotPrecise(value, places), delta); // Returns: 260.77 !
- Assert.assertNotEquals(expected, Round.roundAvoid(value, places), delta); // Returns: 260.77 !
- Assert.assertEquals(expected, Precision.round(value, places), delta);
- Assert.assertNotEquals(expected, DoubleRounder.round(value, places), delta); // Returns: 260.77 !
-
- value = 90080070060.1d;
- places = 9;
- expected = 90080070060.1d;
-
- Assert.assertEquals(expected, Round.round(value, places), delta);
- Assert.assertEquals(expected, Round.roundNotPrecise(value, places), delta);
- Assert.assertNotEquals(expected, Round.roundAvoid(value, places), delta); // Returns: 9.223372036854776E9 !
- Assert.assertEquals(expected, Precision.round(value, places), delta);
- Assert.assertEquals(expected, DoubleRounder.round(value, places), delta);
- }
-}
+package com.baeldung.maths;
+
+import org.apache.commons.math3.util.Precision;
+import org.decimal4j.util.DoubleRounder;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class RoundUnitTest {
+ private double value = 2.03456d;
+ private int places = 2;
+ private double delta = 0.0d;
+ private double expected = 2.03d;
+
+ @Test
+ public void givenDecimalNumber_whenRoundToNDecimalPlaces_thenGetExpectedResult() {
+ Assert.assertEquals(expected, Round.round(value, places), delta);
+ Assert.assertEquals(expected, Round.roundNotPrecise(value, places), delta);
+ Assert.assertEquals(expected, Round.roundAvoid(value, places), delta);
+ Assert.assertEquals(expected, Precision.round(value, places), delta);
+ Assert.assertEquals(expected, DoubleRounder.round(value, places), delta);
+
+ places = 3;
+ expected = 2.035d;
+
+ Assert.assertEquals(expected, Round.round(value, places), delta);
+ Assert.assertEquals(expected, Round.roundNotPrecise(value, places), delta);
+ Assert.assertEquals(expected, Round.roundAvoid(value, places), delta);
+ Assert.assertEquals(expected, Precision.round(value, places), delta);
+ Assert.assertEquals(expected, DoubleRounder.round(value, places), delta);
+
+ value = 1000.0d;
+ places = 17;
+ expected = 1000.0d;
+
+ Assert.assertEquals(expected, Round.round(value, places), delta);
+ Assert.assertEquals(expected, Round.roundNotPrecise(value, places), delta);
+ Assert.assertNotEquals(expected, Round.roundAvoid(value, places), delta); // Returns: 92.23372036854776 !
+ Assert.assertEquals(expected, Precision.round(value, places), delta);
+ Assert.assertEquals(expected, DoubleRounder.round(value, places), delta);
+
+ value = 256.025d;
+ places = 2;
+ expected = 256.03d;
+
+ Assert.assertEquals(expected, Round.round(value, places), delta);
+ Assert.assertNotEquals(expected, Round.roundNotPrecise(value, places), delta); // Returns: 256.02 !
+ Assert.assertNotEquals(expected, Round.roundAvoid(value, places), delta); // Returns: 256.02 !
+ Assert.assertEquals(expected, Precision.round(value, places), delta);
+ Assert.assertNotEquals(expected, DoubleRounder.round(value, places), delta); // Returns: 256.02 !
+
+ value = 260.775d;
+ places = 2;
+ expected = 260.78d;
+
+ Assert.assertEquals(expected, Round.round(value, places), delta);
+ Assert.assertNotEquals(expected, Round.roundNotPrecise(value, places), delta); // Returns: 260.77 !
+ Assert.assertNotEquals(expected, Round.roundAvoid(value, places), delta); // Returns: 260.77 !
+ Assert.assertEquals(expected, Precision.round(value, places), delta);
+ Assert.assertNotEquals(expected, DoubleRounder.round(value, places), delta); // Returns: 260.77 !
+
+ value = 90080070060.1d;
+ places = 9;
+ expected = 90080070060.1d;
+
+ Assert.assertEquals(expected, Round.round(value, places), delta);
+ Assert.assertEquals(expected, Round.roundNotPrecise(value, places), delta);
+ Assert.assertNotEquals(expected, Round.roundAvoid(value, places), delta); // Returns: 9.223372036854776E9 !
+ Assert.assertEquals(expected, Precision.round(value, places), delta);
+ Assert.assertEquals(expected, DoubleRounder.round(value, places), delta);
+ }
+}
diff --git a/java-numbers/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/nth/root/calculator/NthRootCalculatorUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java
similarity index 96%
rename from java-numbers/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java
index b348fe01ef..bfd5ae485b 100644
--- a/java-numbers/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java
+++ b/core-java-modules/java-numbers/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java
@@ -1,106 +1,106 @@
-package com.baeldung.numberofdigits;
-
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.experimental.theories.DataPoints;
-import org.junit.experimental.theories.Theories;
-import org.junit.experimental.theories.Theory;
-import org.junit.runner.RunWith;
-
-@RunWith(Theories.class)
-public class NumberOfDigitsIntegrationTest {
-
- private static NumberOfDigits numberOfDigits;
-
- static {
- numberOfDigits = new NumberOfDigits();
- }
-
- @DataPoints
- public static int[][] lowestIntegers()
- {
- return new int[][]{
- {1, 1},
- {2, 10},
- {3, 100},
- {4, 1000},
- {5, 10000},
- {6, 100000},
- {7, 1000000},
- {8, 10000000},
- {9, 100000000},
- {10, 1000000000}
- };
- }
-
- @DataPoints
- public static int[][] highestIntegers()
- {
- return new int[][]{
- {1, 9},
- {2, 99},
- {3, 999},
- {4, 9999},
- {5, 99999},
- {6, 999999},
- {7, 9999999},
- {8, 99999999},
- {9, 999999999},
- {10, Integer.MAX_VALUE}
- };
- }
-
- @DataPoints
- public static int[][] randomIntegers()
- {
- return new int[][]{
- {1, 1},
- {2, 14},
- {3, 549},
- {4, 1136},
- {5, 25340},
- {6, 134321},
- {7, 1435432},
- {8, 54234129},
- {9, 113683912},
- {10, 1534031982}
- };
- }
-
- @Theory
- public void givenDataPoints_whenStringBasedSolutionInvoked_thenAllPointsMatch(final int[] entry) {
- Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
- Assert.assertEquals(entry[0], numberOfDigits.stringBasedSolution(entry[1]));
- }
-
- @Theory
- public void givenDataPoints_whenLogarithmicApproachInvoked_thenAllPointsMatch(final int[] entry) {
- Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
- Assert.assertEquals(entry[0], numberOfDigits.logarithmicApproach(entry[1]));
- }
-
- @Theory
- public void givenDataPoints_whenRepeatedMultiplicationInvoked_thenAllPointsMatch(final int[] entry) {
- Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
- Assert.assertEquals(entry[0], numberOfDigits.repeatedMultiplication(entry[1]));
- }
-
- @Theory
- public void givenDataPoints_whenShiftOperatorsInvoked_thenAllPointsMatch(final int[] entry) {
- Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
- Assert.assertEquals(entry[0], numberOfDigits.shiftOperators(entry[1]));
- }
-
- @Theory
- public void givenDataPoints_whenDividingWithPowersOf2Invoked_thenAllPointsMatch(final int[] entry) {
- Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
- Assert.assertEquals(entry[0], numberOfDigits.dividingWithPowersOf2(entry[1]));
- }
-
- @Theory
- public void givenDataPoints_whenDivideAndConquerInvoked_thenAllPointsMatch(final int[] entry) {
- Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
- Assert.assertEquals(entry[0], numberOfDigits.divideAndConquer(entry[1]));
- }
-
+package com.baeldung.numberofdigits;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.experimental.theories.DataPoints;
+import org.junit.experimental.theories.Theories;
+import org.junit.experimental.theories.Theory;
+import org.junit.runner.RunWith;
+
+@RunWith(Theories.class)
+public class NumberOfDigitsIntegrationTest {
+
+ private static NumberOfDigits numberOfDigits;
+
+ static {
+ numberOfDigits = new NumberOfDigits();
+ }
+
+ @DataPoints
+ public static int[][] lowestIntegers()
+ {
+ return new int[][]{
+ {1, 1},
+ {2, 10},
+ {3, 100},
+ {4, 1000},
+ {5, 10000},
+ {6, 100000},
+ {7, 1000000},
+ {8, 10000000},
+ {9, 100000000},
+ {10, 1000000000}
+ };
+ }
+
+ @DataPoints
+ public static int[][] highestIntegers()
+ {
+ return new int[][]{
+ {1, 9},
+ {2, 99},
+ {3, 999},
+ {4, 9999},
+ {5, 99999},
+ {6, 999999},
+ {7, 9999999},
+ {8, 99999999},
+ {9, 999999999},
+ {10, Integer.MAX_VALUE}
+ };
+ }
+
+ @DataPoints
+ public static int[][] randomIntegers()
+ {
+ return new int[][]{
+ {1, 1},
+ {2, 14},
+ {3, 549},
+ {4, 1136},
+ {5, 25340},
+ {6, 134321},
+ {7, 1435432},
+ {8, 54234129},
+ {9, 113683912},
+ {10, 1534031982}
+ };
+ }
+
+ @Theory
+ public void givenDataPoints_whenStringBasedSolutionInvoked_thenAllPointsMatch(final int[] entry) {
+ Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
+ Assert.assertEquals(entry[0], numberOfDigits.stringBasedSolution(entry[1]));
+ }
+
+ @Theory
+ public void givenDataPoints_whenLogarithmicApproachInvoked_thenAllPointsMatch(final int[] entry) {
+ Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
+ Assert.assertEquals(entry[0], numberOfDigits.logarithmicApproach(entry[1]));
+ }
+
+ @Theory
+ public void givenDataPoints_whenRepeatedMultiplicationInvoked_thenAllPointsMatch(final int[] entry) {
+ Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
+ Assert.assertEquals(entry[0], numberOfDigits.repeatedMultiplication(entry[1]));
+ }
+
+ @Theory
+ public void givenDataPoints_whenShiftOperatorsInvoked_thenAllPointsMatch(final int[] entry) {
+ Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
+ Assert.assertEquals(entry[0], numberOfDigits.shiftOperators(entry[1]));
+ }
+
+ @Theory
+ public void givenDataPoints_whenDividingWithPowersOf2Invoked_thenAllPointsMatch(final int[] entry) {
+ Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
+ Assert.assertEquals(entry[0], numberOfDigits.dividingWithPowersOf2(entry[1]));
+ }
+
+ @Theory
+ public void givenDataPoints_whenDivideAndConquerInvoked_thenAllPointsMatch(final int[] entry) {
+ Assume.assumeTrue(entry[0] > 0 && entry[1] > 0);
+ Assert.assertEquals(entry[0], numberOfDigits.divideAndConquer(entry[1]));
+ }
+
}
\ No newline at end of file
diff --git a/java-numbers/src/test/java/com/baeldung/pairsaddupnumber/DifferentPairsUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/pairsaddupnumber/DifferentPairsUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/pairsaddupnumber/DifferentPairsUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/pairsaddupnumber/DifferentPairsUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/pairsaddupnumber/ExistingPairsUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/pairsaddupnumber/ExistingPairsUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/pairsaddupnumber/ExistingPairsUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/pairsaddupnumber/ExistingPairsUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/random/JavaRandomUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/random/JavaRandomUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/random/JavaRandomUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/random/JavaRandomUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsManualTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/removingdecimals/RemovingDecimalsUnitTest.java
diff --git a/java-numbers/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java b/core-java-modules/java-numbers/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java
similarity index 100%
rename from java-numbers/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java
rename to core-java-modules/java-numbers/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java
diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml
index 15347d0fe9..12a9f1ec9b 100644
--- a/core-java-modules/pom.xml
+++ b/core-java-modules/pom.xml
@@ -122,7 +122,10 @@
java-collections-conversions
java-collections-conversions-2
java-collections-maps-3
- pre-jpms
+ java-numbers
+ java-numbers-2
+ java-numbers-3
+ java-numbers-4