How to identify deadlock in java?

Java Management Extension provides a powerful APIs to find out all details about the JVM. Today we will write a simple program to find out dead lock in java using JMX API. The intention of this program is only to find the dead lock, the program which is used to create the dead lock should not be used any application in any circumstances. However DeadlockFinderThread shall be used in the development environment to find out the dead lock.

Console output.