solve 5.5-5.6, Java