Read google custom search API example java for more information.
Build a fully customizable Search without any coding
Google custom search API example in java
public static void main(String[] args) throws Exception { String key="YOUR KEY"; String qry="Android"; URL url = new URL( "https://www.googleapis.com/customsearch/v1?key="+key+ "&cx=013036536707430787589:_pqjad5hr1a&q="+ qry + "&alt=json"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/json"); BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { if(output.contains("\"link\": \"")){ String link=output.substring(output.indexOf("\"link\": \"")+("\"link\": \"").length(), output.indexOf("\",")); System.out.println(link); //Will print the google search links } } conn.disconnect(); }