Jan 22, 2018
Insertion Sort Algorithm In Java
Insertion sort is a simple algorithm. Insertion sort logic works as follows: To insert an element in an already existing set, we make room for the new item
Jan 21, 2018
Selection Sort Algorithm in Java
Selection sort is one of the simplest sorting algorithms. It is easy to implement but it is not very efficient. The algorithm divides the input list into two pa
Jan 1, 2018
How to calculate the height of a Non-Binary Tree
Computing the height of a tree in Computer Science is very common. Most of the examples and online discussions talk about computing the height of a Binary Tree.
Dec 23, 2017
Easiest way to calculate elapsed time in Java
Quite often in our day-to-day programming, we need to compute how long a specific portion of the code takes to complete. For e.g; you might want to check how lo
Dec 8, 2017
Java Regular Expression to Validate Social Security Number (SSN)
Here is a utility method to check if a given String is a valid Social Security number using Java Regular Expression.
Dec 4, 2017
Java Regular Expression to check if a String is a numeric value
Here is another method from my String utility class. This method uses a regular expression to check if a String is a numeric value. Look at the code, then read
Dec 3, 2017
How to delete Workspace from Eclipse Launcher Selection
Launch Eclipse Click on Recent Workspaces Eclipse will list all previously used workspaces Right click on the workspace name that you want to remove Click on Re
Dec 1, 2017
How to generate random alpha numeric String in Java
Following code is an example of generating a random alpha-numeric string using Java Random class. It is designed to generate random String of varying length bas
Nov 28, 2017
Java Scanner’s unexpected behavior following nextInt or nextDouble call
Scanner is a utility class that provides methods to read command-line input. It is a very useful class, but you need to be aware of its unexpected behavior whil
Nov 25, 2017
How to compare Java Strings correctly
One of the most common bugs I’ve seen in Java programs is the use of the == operator to compare two String objects. Most of the time the result may be acc
Nov 24, 2017
Java RegEx to validate Gmail address
I’ve written about Java regular expression to validate email addresses before. Today I am sharing another Java regex to validate Gmail address. It
Nov 23, 2017
How to find largest and smallest numbers from input in Java
Following simple Java program shows how to read input values and then print smallest and largest values. It reads the input from standard input using Scanner an
Nov 22, 2017
Array Bubble Sort in Java
Although Java’s Arrays class has a built-in method to sort an array, it is important for good Java developers to know how to sort an array on their own. B
Sep 8, 2016
Top 10 Eclipse Keyboard shortcuts for Java developers
Here is a list of 10 commonly used Eclipse shortcuts for Java developers. Ctrl + Shift + T: Open a type (e.g.; a class, an interface) without browsing through l
Dec 3, 2012
How to validate Date using Javascript Regular Expression
Here is a simple Javascript function to validate a date in US format.