...
On the Setup page you'll find a menu item called 'Reset My Security Token'. Navigate to this menu item and have it send you the token in an email.
Usage
Let's assume your username is 'foo', your password is 'bar' and your security token is 'baz'. Here's then your Java code needed to connect to Salesforce (and a small example query):
...