How to use methods?

I’m trying to create a Login testcase by using a method.
It’s supposed to look like:

login(driver)  //This is my method

I have two questions:
1)How can I pass the current WebDriver element to my method?
2)I want to have a class that will contain my login() method as a static method (and other static methods in the future).
How do I do that?
Thank you.