onetake problem solving using java