What are the common performance bottlenecks when working with Java applications, and how do you resolve them?