public void getTwitterTimeline() {
    	try {
    		Twitter twitter = new TwitterFactory().getInstance();
    		try {
    			RequestToken requestToken = twitter.getOAuthRequestToken();
    			System.out.println("Got request token.");
    			System.out.println("Request token: " + requestToken.getToken());
    			System.out.println("Request token secret: " + requestToken.getTokenSecret());
    			AccessToken accessToken = null;
    			accessToken = new AccessToken("36063580-4ct4i8XBLnT1i7CcoLEPSyx0JofWXLWvA9XsuJraa", "HwC4qx8u0gLDcXlIUOEuw54JFYAsB0LKSVDmV4xy6KF2H");
    			twitter.setOAuthAccessToken(accessToken);
    			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    			while (null == accessToken) {
    				System.out.println("Open the following URL and grant access to your account:");
    				System.out.println(requestToken.getAuthorizationURL());
    				System.out.print("Enter the PIN(if available) and hit enter after you granted access.[PIN]:");
    				String pin = br.readLine();
    				try {
    					if (pin.length() > 0) {
    						accessToken = twitter.getOAuthAccessToken(requestToken, pin);
    					} else {
    						accessToken = twitter.getOAuthAccessToken(requestToken);
    					}
    				} catch (TwitterException te) {
    					if (401 == te.getStatusCode()) {
    						System.out.println("Unable to get the access token.");
    					} else {
    						te.printStackTrace();
    					}
    				}
    			}
    			System.out.println("Got access token.");
    			System.out.println("Access token: " + accessToken.getToken());
    			System.out.println("Access token secret: " + accessToken.getTokenSecret());
    		} catch (IllegalStateException ie) {
    			// access token is already available, or consumer key/secret is not set.
    			if (!twitter.getAuthorization().isEnabled()) {
    				System.out.println("OAuth consumer key/secret is not set. " + ie.getMessage());
    				System.exit(-1);
    			}
    		}
    		List<Status> statuses = twitter.getHomeTimeline();
    	    System.out.println("Showing home timeline.");
    	    for (Status status : statuses) {
    	        System.out.println(status.getUser().getName() + ":" +
    	                           status.getText());
    	    }
    	} catch (TwitterException te) {
    		te.printStackTrace();
    		System.out.println("Failed to get timeline: " + te.getMessage());
    		System.exit(-1);
    	} catch (IOException ioe) {
    		ioe.printStackTrace();
    		System.out.println("Failed to read the system input.");
    		System.exit(-1);
    	}
    }