There's a step by step guide on facebook developers website.
You have to work with an access token that will allow you to use a user's facebook account. Once you've the access, call the appropriate api with user permission to fetch information like basic profile info, friends list, photo, etc.
The RestFB api is open source and is quite good, I haven't had the chance to work with it yet but before using it create a Facebook application and request an OAuth access token. And then proceed as illustrated on the RestFB page.
Something like this:
FacebookClient facebookClient = new DefaultFacebookClient(YOUR_ACCESS_TOKEN);
User user = facebookClient.fetchObject("me", User.class);
Page page = facebookClient.fetchObject("cocacola", Page.class);
out.println("User name: " + user.getName());
out.println("Page likes: " + page.getLikes());