How to convert an ArrayList to array in Java

1 Comment


Today, I will share a very basic Java program that converts an ArrayList to array. For most Java developers this is a routine task, but many new comers to Java have asked me this question of how to convert an array to ArrayList. Here is the example code.
More

article clipper vert How to convert an ArrayList to array in Java
 

How to add Amazon affiliate links to your posts in one step.

5 Comments

Amazon.com being the largest online retailer offers a variety of merchandise. Because of their huge selection of products it is no surprise that Amazon affiliate program is so popular among bloggers.

With an astonishing number of products available through Amazon.com it is quite likely that every blogger will find a related product to link in every blog post. On the other hand, this vast jungle of products can also be overwhelming for bloggers who naturally want to spend their time on writing post not searching for related products.

Unfortunately, Amazon did not offer any help to bloggers to easily create affiliate-links for its products. Every affiliate has to find related products using their keywords and then manually create the link into the articles. This is laborious and cumbersome exercise.

But now there is a better alternative. More

article clipper vert How to add Amazon affiliate links to your posts in one step.
 

How to validate date using Java regular expression

7 Comments


My earlier post on how to validate email address, SSN and phone number validation using Java regex still attracts lot of visitors. Today I realized that another piece of data that many programmers need to validate is the date. Many Java applications have to process input date values, so I thought it will be beneficial to this blog readers to show how regular expression can be used to validate date in java.

First I’ll show you how to validate date using java reg ex in US format and later I’ll show you how that same logic can be applied to validate date in English format (used in most countries outside North America).
More

article clipper vert How to validate date using Java regular expression
 

How to write to properties file in Java

4 Comments


One of most visited posts on this blog is How to read properties file in Java. In that post I explained how you can read from a properties file. But many people came to that post searching for an example on how to write to a properties file. So I thought it will be beneficial for those visitors if we a have separate post with an example of how to write to a properties file in Java.

More

article clipper vert How to write to properties file in Java
 

Best way to check if a Java String is a number.

2 Comments

One of the routine tasks in many Java applications is to convert a string to a number. For instance, you may have a form where user submits his or her age. The input will come to your Java application as a String but if you need the age to do some calculation you need to convert that String into a number.
More

article clipper vert Best way to check if a Java String is a number.