I am not exactly sure what you are asking, but I would refer you to Head First Java by Sierra & Bates for some quality Java learning. If you more experienced perhaps the SCJP guide by the same Sierra & Bates would be good for you. Even if you aren't studying it does give you some good lessons on Java and programming!
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
The Deitel "How to" books have exercises after each chapter. We have a few questions on the Ranch here. Look for javabat (can't remember the link, but it should be easy to find on Google) for questions about algorithms.