Problem Solving Java Programming