In below code example you will learn how to use org.apache.commons.codec.digest.DigestUtils class in Apache Commons Codec to generate SHA-1 string in Java.