bette java solution