If you run Cucumber-JVM it will generate snippets for each undefined step. You can cut and paste these into a class of your choosing.
Running inside IntelliJ you can use Alt-Return to generate a definition for a step. There are plugins for Eclipse that do this too, but I haven't used them recently.