Using API with restAssurd is an easy way:
public static String[] getCoordinates(String address, String county) throws IOException, ParserConfigurationException, SAXException {
address = address.replace(",", "+");
address = address.replace(" ", "+");
county = county.replace(" ", "");
String fullAddress = address+"+"+county;
System.out.println(fullAddress);
URL url = new URL("http://maps.google.com/maps/api/geocode/json?address="+fullAddress+"&sensor=false");
Response res = given().
when().
get(url);
JsonPath jp = new JsonPath(res.asString());
String lat = jp.get("results.geometry.location.lat").toString();
String lng = jp.get("results.geometry.location.lng").toString();
String[] location = new String[2];
location[0] = lat;
location[1] = lng;
return location;
}