I wrote this class for our Xbox controllers.
https://github.com/Team3309/FRC2013/...ontroller.java
If you use Xbox controllers, this should work out-of-the-box for you, but if not it is still a good starting point. I have had a lot of trouble getting the analog triggers to work with the controller, so the methods to get the triggers (not the bumpers) do not actually work.
If you use a controller other than an Xbox controller you can try this class out and if it doesn't work (just print out the values and see if its what you're expecting) then modify the constants in the beginning of the class until the methods return the right values for their respective axis or button.