title: Python to java conversion
body: <p>I have my original python script as follows.</p>
  
  <pre><code>#!/usr/bin/env python
  
  import math,sys
  import json
  import urllib
  
  def gsearch(searchfor):
    query = urllib.urlencode({'q': searchfor})
    url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;%s' % query
    search_response = urllib.urlopen(url)
    search_results = search_response.read()
    results = json.loads(search_results)
    data = results['responseData']
    return data
  
  args = sys.argv[1:]
  m = 45000000000
  if len(args) != 2:
          print "need two words as arguments"
          exit
  n0 = int(gsearch(args[0])['cursor']['estimatedResultCount'])
  n1 = int(gsearch(args[1])['cursor']['estimatedResultCount'])
  n2 = int(gsearch(args[0]+" "+args[1])['cursor']['estimatedResultCount'])
  </code></pre>
  
  <p>I am in the midst of converting it into java. I have done all the following. I am stuck here search_results = search_response.read()  results = json.loads(search_results)       data = results['responseData'] . I dont know how to convert these 3 lines into java.</p>
  
  <pre><code>import java.io.*;
  import java.io.FileInputStream;
  import java.io.InputStream;
  import java.net.URL;
  import java.net.URLEncoder;
  import java.net.URLConnection;
  
  public class gi {
  
     public static void main (String[] args) {
  
       if(args.length==2){
  
           for(int i = 0; i &lt; args.length; i++) {
                  System.out.println("I IS : "+i+":"+args[i]);
              }
           int n0 = searchGoogle(args[0]);
           int n1 = searchGoogle(args[1]);
           int n2 = searchGoogle(args[0]+" "+args[1]);
       }
       else{
          System.out.println("Not enough arguement");
       }
     }
     public static int searchGoogle(String searchQuery)
     {
      try{
  
      String query=URLEncoder.encode(searchQuery, "UTF-8");
      String url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;%s" + query;
      URLConnection connection = new URL(url).openConnection();
      }
      catch(Exception e){
      }
      int pageQty=0;
      return pageQty;
     }
  
  }  // end of ReadString class
  </code></pre>