diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/CheckedUncheckedExceptions.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/CheckedUncheckedExceptions.java
new file mode 100644
index 0000000000..780189b654
--- /dev/null
+++ b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/CheckedUncheckedExceptions.java
@@ -0,0 +1,43 @@
+package com.baeldung.exceptions;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+public class CheckedUncheckedExceptions {
+ public static void checkedExceptionWithThrows() throws FileNotFoundException {
+ File file = new File("not_existing_file.txt");
+ FileInputStream stream = new FileInputStream(file);
+ }
+
+ public static void checkedExceptionWithTryCatch() {
+ File file = new File("not_existing_file.txt");
+ try {
+ FileInputStream stream = new FileInputStream(file);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static int divideByZero() {
+ int numerator = 1;
+ int denominator = 0;
+ return numerator / denominator;
+ }
+
+ public static void checkFile(String fileName) throws IncorrectFileNameException {
+ if (fileName == null || fileName.isEmpty()) {
+ throw new NullOrEmptyException("The filename is null.");
+ }
+ if (!isCorrectFileName(fileName)) {
+ throw new IncorrectFileNameException("Incorrect filename : " + fileName);
+ }
+ }
+
+ private static boolean isCorrectFileName(String fileName) {
+ if (fileName.equals("wrongFileName.txt"))
+ return false;
+ else
+ return true;
+ }
+}
diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/IncorrectFileNameException.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/IncorrectFileNameException.java
new file mode 100644
index 0000000000..9877fe25ca
--- /dev/null
+++ b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/IncorrectFileNameException.java
@@ -0,0 +1,13 @@
+package com.baeldung.exceptions;
+
+public class IncorrectFileNameException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public IncorrectFileNameException(String errorMessage) {
+ super(errorMessage);
+ }
+
+ public IncorrectFileNameException(String errorMessage, Throwable thr) {
+ super(errorMessage, thr);
+ }
+}
\ No newline at end of file
diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/NullOrEmptyException.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/NullOrEmptyException.java
new file mode 100644
index 0000000000..d4ee9c0d6f
--- /dev/null
+++ b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/NullOrEmptyException.java
@@ -0,0 +1,14 @@
+package com.baeldung.exceptions;
+
+public class NullOrEmptyException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public NullOrEmptyException(String errorMessage) {
+ super(errorMessage);
+ }
+
+ public NullOrEmptyException(String errorMessage, Throwable thr) {
+ super(errorMessage, thr);
+ }
+}
\ No newline at end of file
diff --git a/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/CheckedUncheckedExceptionsUnitTest.java b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/CheckedUncheckedExceptionsUnitTest.java
new file mode 100644
index 0000000000..d82b1349d8
--- /dev/null
+++ b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/CheckedUncheckedExceptionsUnitTest.java
@@ -0,0 +1,55 @@
+package com.baeldung.exceptions;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.io.FileNotFoundException;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests the {@link CheckedUncheckedExceptions}.
+ */
+public class CheckedUncheckedExceptionsUnitTest {
+
+ @Test
+ public void whenFileNotExist_thenThrowException() {
+ assertThrows(FileNotFoundException.class, () -> {
+ CheckedUncheckedExceptions.checkedExceptionWithThrows();
+ });
+ }
+
+ @Test
+ public void whenTryCatchExcetpion_thenSuccess() {
+ try {
+ CheckedUncheckedExceptions.checkedExceptionWithTryCatch();
+ } catch (Exception e) {
+ Assertions.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void whenDivideByZero_thenThrowException() {
+ assertThrows(ArithmeticException.class, () -> {
+ CheckedUncheckedExceptions.divideByZero();
+ });
+ }
+
+ @Test
+ public void whenInvalidFile_thenThrowException() {
+
+ assertThrows(IncorrectFileNameException.class, () -> {
+ CheckedUncheckedExceptions.checkFile("wrongFileName.txt");
+ });
+ }
+
+ @Test
+ public void whenNullOrEmptyFile_thenThrowException() {
+ assertThrows(NullOrEmptyException.class, () -> {
+ CheckedUncheckedExceptions.checkFile(null);
+ });
+ assertThrows(NullOrEmptyException.class, () -> {
+ CheckedUncheckedExceptions.checkFile("");
+ });
+ }
+}
diff --git a/gradle-5/.gitignore b/gradle-5/.gitignore
deleted file mode 100644
index 7dd8895f4b..0000000000
--- a/gradle-5/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/build/
-/bin/
-.settings
-.gradle
-.project
-.classpath
\ No newline at end of file
diff --git a/java-blockchain/.gitignore b/java-blockchain/.gitignore
new file mode 100644
index 0000000000..3de4cc647e
--- /dev/null
+++ b/java-blockchain/.gitignore
@@ -0,0 +1,26 @@
+*.class
+
+0.*
+
+#folders#
+/target
+/neoDb*
+/data
+/src/main/webapp/WEB-INF/classes
+*/META-INF/*
+.resourceCache
+
+# Packaged files #
+*.jar
+*.war
+*.ear
+
+# Files generated by integration tests
+*.txt
+backup-pom.xml
+/bin/
+/temp
+
+#IntelliJ specific
+.idea/
+*.iml
\ No newline at end of file
diff --git a/java-blockchain/README.md b/java-blockchain/README.md
new file mode 100644
index 0000000000..600f4dd610
--- /dev/null
+++ b/java-blockchain/README.md
@@ -0,0 +1,6 @@
+=========
+
+## Basic Implementation of Blockchian in Java
+
+### Relevant Articles:
+- []()
diff --git a/java-blockchain/pom.xml b/java-blockchain/pom.xml
new file mode 100644
index 0000000000..2f9e011aa7
--- /dev/null
+++ b/java-blockchain/pom.xml
@@ -0,0 +1,40 @@
+
+ 4.0.0
+ com.baeldung.blockchain
+ java-blockchain
+ 0.1.0-SNAPSHOT
+ java-blockchain
+ jar
+
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../parent-java
+
+
+ java-blockchain
+
+
+ src/main/resources
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ ${maven.compiler.target}
+
+
+
+
+
+ 1.8
+ 1.8
+
+
\ No newline at end of file
diff --git a/java-blockchain/src/main/java/com/baeldung/blockchain/Block.java b/java-blockchain/src/main/java/com/baeldung/blockchain/Block.java
new file mode 100644
index 0000000000..264e3c4b69
--- /dev/null
+++ b/java-blockchain/src/main/java/com/baeldung/blockchain/Block.java
@@ -0,0 +1,65 @@
+package com.baeldung.blockchain;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class Block {
+
+ private static Logger logger = Logger.getLogger(Block.class.getName());
+
+ private String hash;
+ private String previousHash;
+ private String data;
+ private long timeStamp;
+ private int nonce;
+
+ public Block(String data, String previousHash) {
+ this.data = data;
+ this.previousHash = previousHash;
+ this.timeStamp = new Date().getTime();
+ this.hash = calculateBlockHash();
+ }
+
+ public String mineBlock(int prefix) {
+ String prefixString = new String(new char[prefix]).replace('\0', '0');
+ while (!hash.substring(0, prefix)
+ .equals(prefixString)) {
+ nonce++;
+ hash = calculateBlockHash();
+ }
+ return hash;
+ }
+
+ public String calculateBlockHash() {
+ String dataToHash = previousHash + Long.toString(timeStamp) + Integer.toString(nonce) + data;
+ MessageDigest digest = null;
+ byte[] bytes = null;
+ try {
+ digest = MessageDigest.getInstance("SHA-256");
+ bytes = digest.digest(dataToHash.getBytes("UTF-8"));
+ } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
+ logger.log(Level.SEVERE, ex.getMessage());
+ }
+ StringBuffer buffer = new StringBuffer();
+ for (byte b : bytes) {
+ buffer.append(String.format("%02x", b));
+ }
+ return buffer.toString();
+ }
+
+ public String getHash() {
+ return this.hash;
+ }
+
+ public String getPreviousHash() {
+ return this.previousHash;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+}
diff --git a/java-blockchain/src/main/resources/logback.xml b/java-blockchain/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/java-blockchain/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/java-blockchain/src/test/java/com/baeldung/blockchain/BlockchainUnitTest.java b/java-blockchain/src/test/java/com/baeldung/blockchain/BlockchainUnitTest.java
new file mode 100644
index 0000000000..acbf651e78
--- /dev/null
+++ b/java-blockchain/src/test/java/com/baeldung/blockchain/BlockchainUnitTest.java
@@ -0,0 +1,67 @@
+package com.baeldung.blockchain;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class BlockchainUnitTest {
+
+ public static List blockchain = new ArrayList();
+ public static int prefix = 4;
+ public static String prefixString = new String(new char[prefix]).replace('\0', '0');
+
+ @BeforeClass
+ public static void setUp() {
+ Block genesisBlock = new Block("The is the Genesis Block.", "0");
+ genesisBlock.mineBlock(prefix);
+ blockchain.add(genesisBlock);
+ Block firstBlock = new Block("The is the First Block.", genesisBlock.getHash());
+ firstBlock.mineBlock(prefix);
+ blockchain.add(firstBlock);
+ }
+
+ @Test
+ public void givenBlockchain_whenNewBlockAdded_thenSuccess() {
+ Block newBlock = new Block("The is a New Block.", blockchain.get(blockchain.size() - 1)
+ .getHash());
+ newBlock.mineBlock(prefix);
+ assertTrue(newBlock.getHash()
+ .substring(0, prefix)
+ .equals(prefixString));
+ blockchain.add(newBlock);
+ }
+
+ @Test
+ public void givenBlockchain_whenValidated_thenSuccess() {
+ boolean flag = true;
+ for (int i = 0; i < blockchain.size(); i++) {
+ String previousHash = i == 0 ? "0"
+ : blockchain.get(i - 1)
+ .getHash();
+ flag = blockchain.get(i)
+ .getHash()
+ .equals(blockchain.get(i)
+ .calculateBlockHash())
+ && previousHash.equals(blockchain.get(i)
+ .getPreviousHash())
+ && blockchain.get(i)
+ .getHash()
+ .substring(0, prefix)
+ .equals(prefixString);
+ if (!flag)
+ break;
+ }
+ assertTrue(flag);
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ blockchain.clear();
+ }
+
+}
diff --git a/java-blockchain/src/test/resources/.gitignore b/java-blockchain/src/test/resources/.gitignore
new file mode 100644
index 0000000000..83c05e60c8
--- /dev/null
+++ b/java-blockchain/src/test/resources/.gitignore
@@ -0,0 +1,13 @@
+*.class
+
+#folders#
+/target
+/neoDb*
+/data
+/src/main/webapp/WEB-INF/classes
+*/META-INF/*
+
+# Packaged files #
+*.jar
+*.war
+*.ear
\ No newline at end of file
diff --git a/java-jdi/src/main/java/com/baeldung/jdi/JDIExample.java b/java-jdi/src/main/java/com/baeldung/jdi/JDIExampleDebuggee.java
similarity index 92%
rename from java-jdi/src/main/java/com/baeldung/jdi/JDIExample.java
rename to java-jdi/src/main/java/com/baeldung/jdi/JDIExampleDebuggee.java
index f8f20553b8..4fb49024fb 100644
--- a/java-jdi/src/main/java/com/baeldung/jdi/JDIExample.java
+++ b/java-jdi/src/main/java/com/baeldung/jdi/JDIExampleDebuggee.java
@@ -1,6 +1,6 @@
package com.baeldung.jdi;
-public class JDIExample {
+public class JDIExampleDebuggee {
public static void main(String[] args) {
String jpda = "Java Platform Debugger Architecture";
diff --git a/java-jdi/src/main/java/com/baeldung/jdi/JDIExampleDebugger.java b/java-jdi/src/main/java/com/baeldung/jdi/JDIExampleDebugger.java
index 1d9de57ddb..41a568e55f 100644
--- a/java-jdi/src/main/java/com/baeldung/jdi/JDIExampleDebugger.java
+++ b/java-jdi/src/main/java/com/baeldung/jdi/JDIExampleDebugger.java
@@ -123,7 +123,7 @@ public class JDIExampleDebugger {
public static void main(String[] args) throws Exception {
JDIExampleDebugger debuggerInstance = new JDIExampleDebugger();
- debuggerInstance.setDebugClass(JDIExample.class);
+ debuggerInstance.setDebugClass(JDIExampleDebuggee.class);
int[] breakPoints = {6, 9};
debuggerInstance.setBreakPointLines(breakPoints);
VirtualMachine vm = null;
diff --git a/java-strings-2/src/main/java/com/baeldung/string/streamtokenizer/StreamTokenizerDemo.java b/java-strings-2/src/main/java/com/baeldung/string/streamtokenizer/StreamTokenizerDemo.java
new file mode 100644
index 0000000000..3bb0ff5b77
--- /dev/null
+++ b/java-strings-2/src/main/java/com/baeldung/string/streamtokenizer/StreamTokenizerDemo.java
@@ -0,0 +1,76 @@
+package com.baeldung.string.streamtokenizer;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class StreamTokenizerDemo {
+
+ private static final String INPUT_FILE = "/stream-tokenizer-example.txt";
+ private static final int QUOTE_CHARACTER = '\'';
+ private static final int DOUBLE_QUOTE_CHARACTER = '"';
+
+ public static List