If your running 4.0.1 you can jailbreak it by going to jailbreakme.com on your iphone, if its 4.0.2 your shit out of luck.
If you ever need to take it back to Apple for anything then just restore the phone which will wipe all traces of the jailbreak.