You can extract a method from an expression at the caret, or from a group of selected statements. Press (Refactor | Extract | Method).