title: Reverse geocoding using java example
body: <p>java code of reverse geocoding using java in two stratergires using GeoApiContext and HttpClient.</p>
  
  <p>public class ReverseGeoCoderUtil {</p>
  
  <pre><code>    /**
       * Reverse Geocoding and returns formated Address .
       * eg:getFormatedAdress(40.714224, -73.961452);
       * 
       * @param latitude     latitude value
       * @param longitude    longitude value
       * @param googleApiKey
       * @throws Exception if a reverse geocoding error occurred
       * @return formated Address
       */
      public static String getFormatedAdress(double latitude, double longitude, String googleApiKey) throws Exception 
      {
          GeoApiContext context = new GeoApiContext.Builder().apiKey(googleApiKey).build();
          String name = "(Unknown)";
          try {
              GeocodingResult[] results = GeocodingApi.reverseGeocode(context, new LatLng(latitude, longitude)).await();
              for (GeocodingResult result : results) {
                  return result.formattedAddress;
              }
          } catch (Exception e) {
              throw new Exception("Error on Reverse Geocoding");
          }
  
          return name;
      }        
  
  
  }
  </code></pre>