In this post we will discuss the difference between File APIs two methods mkdir() and mkdirs(). mkdir() vs mkdirs() mkdir() method will create folder only if the immediate parent folder is missing. If any of the parent the folder is missing the mkdir() method will return false. mkdirs() method will create all the folders if
Java Get Files with Particular Extension
Sometimes we might need files with a particular extension. We will see how to get a file with a particular extension in Java 8. Say there are various files extensions like .pdf, .doc, .txt, etc. Suppose we need files only in .txt extension we will use Java NIO Path API to get files ending with
Find Duplicate Numbers in Java 2D Array
Various approaches for Finding Duplicate Numbers in Java 2D Array are discussed here. We will be using Traditional for loop, Set Interface, Map interface using JDK earlier versions, and JDK 8. Finally, the main program is given to run all the codes. For loop – Java 1 to 4 Convert the 2D array to a
Java Convert 2D array to 1D Array
Converting 2D array to 1D array in java can be achieved in various ways. Here we are going to discuss three ways using for loop, enhanced for loop, and Java 8 syntax. Using for loop Iterate the 2D array and convert it to a 1D array using the for loop. This loop is used in
Java 2D Array Find Min Number
In Java, if a 2D array is given as input we can find the Min number using the for loop or Java 8 IntSummaryStatistics class. We have taken a 2D multidimensional array as input. Our goal is to traverse the two dimensional array and find the minimum number from it. In the previous example, we