The Oracle JDK (also OpenJDK) comes with a powerful profiler called VisualVM; the distribution that comes with the JDK is known as Java VisualVM and can be invoked using the binary executable:
This launches the GUI profiler app where you can connect to running instances of the JVM. The profiler has powerful features (https://visualvm.java.net/features.html) that can be useful for finding various bottlenecks in code. Besides analyzing heap dump and thread dump, VisualVM can interactively graph CPU and heap consumption, and thread status in near real time. It also has sampling and tracing profilers for both CPU and memory.