title: Check Geopoint within geoFence and Distance in Java
body: <p>I am new to Java. I have created a geofence with circle shape. I know the center(Latitude,longitude) point and radius(in meter). I want to check whether a geo point(i.e. latitude, longitude) is within this fence, and if it is true I want to find distance between that geopoint to the center point. How can I do this in java. In mysql there is one query for doing this  </p>
  
  <pre><code> SELECT tripid,create_time, ( 6371 * acos( cos( radians(8.475316) ) * cos(    
  radians(lattitude ) ) * cos(
  radians( longitude ) - radians(76.962528) ) + sin( radians(8.475316) ) * sin(  
   radians( lattitude ) ) ) ) AS
   distance
  FROM pack_history where speed&lt;5 and tripid=685  HAVING distance &lt; 0.10 ORDER BY       
  create_time desc LIMIT 0 ,100;
  </code></pre>
  
  <p>How can i do this similar functionality in Java??
  <img src="https://i.stack.imgur.com/DQDo3.jpg" alt="enter image description here"></p>