Tag: Java

Apache Maven is distributed in several formats. The simplest way to install Maven is to download a ready-made binary distribution archive and follow the installation instructions. Maven 3.3+ release requires JDK 1.7 or above to execute. General Requirements Java JDK must be installed on system. Java 1.7 or higher is needed for Maven. To verify the […]Continue reading

In this post, I will explain the Merge Sort algorithm and how to use it in Java. Sorting is the process of arranging data in ascending or descending order. Sorting becomes necessary while searching a particular record in database, a particular telephone number in telephone directory, words in a dictionary, and so on. In computer […]Continue reading

It’s a fairly common task as a Java developer to convert from a List to an Array or from an Array to a list. In one of my previous post, I discussed about converting Map to List. Like many things in Java, there is often more than one way to accomplish a task. In this […]Continue reading

Converting a Java Map to a List is a very common task. Map and List are common data structures used in Java. A Map is a collection of key value pairs. While a List is an ordered collection of objects in which duplicate values can be stored. In this post, I will discuss different ways to […]Continue reading

A common requirement while programming in Java is to convert String to int. UI inputs in Web-based HTML, JSP, or Thymeleaf templates are transferred to backend Java applications as strings. It is the application developer’s responsibility to perform any String to int conversions to fulfill business logic, such as calculating discounts, storing age, and so […]Continue reading

One common requirement in Java application is to iterate through the elements of a collection. Prior to Java 8, the three most common ways to iterate through a collection are by using the while loop, for loop, and enhanced for loop. As the Java Collection interface extends Iterable, you can also use the hasNext() and […]Continue reading

While developing applications, we often need to generate random numbers. Java provides support to generate random numbers primarily through the java.lang.Math and java.util.Random classes. Java also has the ability to generate secure random with java.security.SecureRandom, and random numbers isolated to the current thread with java.util.concurrent.ThreadLocalRandom. You can use the java.util.Random class to generate random numbers of different […]Continue reading

If you are still using System.out to print debugging or diagnostic information in your application, it’s time to look for a more elegant and efficient solution in the form of a logging framework. Although there are lots of logging frameworks around for Java applications, Log4J is one of the most widely adopted one because of […]Continue reading

The latest TIOBE index has Java language moving strongly into the #1 programming language for January 2016. If you’re not familiar with the TIOBE Index, it’s an index that looks at searches on the major search engines, blogs, forums, and Youtube (Did you know Youtube is now the second biggest search engine?) The “Popularity of […]Continue reading