This week's book giveaway is in the Programmer Certification forum. We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Judging from the name of the class, that example would come from Chapter 6 of whatever book you're reading. Doesn't the book have an explanation of what that code is supposed to do? Which lines are you not clear about?
The best ideas are the crazy ones. If you have a crazy idea and it works, it's really valuable.—Kent Beck
I often find that such convoluted code is easier to handle if you write all the variables on a sheet of paper, following their values' changes as you run through the program. It is unfortunately poor quality code, the likes of which are usually only seen in certification exam preparation books.
The overall mission is to change the world. When you've done that, then you can read this tiny ad: