Useful utility classes in Apache Commons lang library

Useful utility classes in Apache Commons lang library

The standard Java libraries fail to provide enough methods for manipulation of its core classes. Apache Commons Lang provides these extra methods. We will discuss some of the useful utility classes in Apache Commons lang library. Apache commons is a collection of open source reusable Java components. Apache commons lang is one of the libraries under Apache commons project.

Apache Commons Lang

Commons Lang provides a number of helper utility classes for the java.lang API, notably String manipulation methods, basic numerical methods, object reflection, concurrency, creation and serialization and System properties. Additionally it contains basic enhancements to java.util.Date and a series of utilities dedicated to help with building methods, such as hashCode, toString and equals.

Note that Lang 3.0 (and subsequent versions) use a different package (org.apache.commons.lang3) than the previous versions (org.apache.commons.lang), allowing it to be used at the same time as an earlier version.

In this post we will see some of the useful classes and its methods provided by Apache commons lang 3. The binary can be downloaded here.

The StringUtils class provides set of methods for String manipulation. Here is an example program showing usage of some of these methods.


This class provides methods for Operations for random Strings. Here is an example program showing the usage.

DateUtils contains a lot of common methods considering manipulations of Dates or Calendars. Here is an example.

This class provides extra functionality for Java Number classes. Let us see a sample program.


This class has many useful method for operations on arrays. Here is a sample program.

These are some of the useful utility classes. There are other notable utility classes like WordUtils, SystemUtils, StrTokenizer etc. To see the full list of classes in commons lang package check the JavaDoc.

I hope that you find these utility classes in Apache commons lang package useful for your development. Also read my another post on most useful Java libraries. Thank you for reading.


The following two tabs change content below.
Working as a Java developer since 2010. Passionate about programming in Java. I am a part time blogger.

Add Comment

Required fields are marked *. Your email address will not be published.