First task(Java)