Java Solution for Alogorithm Problem Solving Strategies