This week's book giveaway is in the OCAJP forum. We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line! See this thread for details.
One thing I can say is that this function is waaay too big. You should factor parts out to smaller functions so it's easier to see one level of abstraction at a time. Hide implementation details behind intention-revealing function names. That's one way to get a handle on the complexity of the code.