Algorithm coding

My project is based on PersonalizedTravelPackageWithMulti-Point-of-InterestRecommendation Based on Crowdsourced User Footprints in which I need to code tyhe TRP Algorithm mentioned there using java progg lang for android studio. How to use JSON/Retrofit with Foursquare apis to obtain venue name lat lng  address checkin counts & rating Im using venue category say history the POIs under history should be acquired with the above mentioned details for the following API:

https://api.foursquare.com/v2/venues/explore?client_id=TDQG4LF1M1O5SZESHJ42BRSZQDPJY4B53NQN5RDTRRZZPNYM&client_secret=PGLQ4RV5R0FDIPHAPJO4RT3KJXO02ARZ4LQ3NWS3TPFIUUJ0&v=20130815&ne=19.241143,72.994881&query=history&sw=18.912417,72.82397

any help?

TRP.png
I have understood the following from the code.

LatLng (StartPoint)P;//onLongPress Obtain lat lng of location and transmit using Shared Preferences to TRP
// StartTime Ts;EndTime Te;//Obtain time in minutes from custom timepicker1&timepicker2 || TimeUnit
//Minimal Threshold th=0.3;

User u(Adding user preferences)//History//Hospital//Veg||Nonveg
OPENSET=P;
PATHTREE=P;
Array poix;

while(OPENSET!=NULL){
x= Header of OPENSET;//Parent node of OPENSET
       //Remove x from OPENSET not to traverse again.

for(int y=1,i=0;poix[i];;//i++,y++)
for(i=0;i<poix.length();i++)
{
x=poix[i];
y= poix[i+1];
ST=x.t+Move(x,y)+60mins;

//SimulateTime=x.t+Move(x,y)+Stay(y);//x.t get timestamp of onMapClick ||
      // obtain the time in minutes from time picker 1
     //Move(x,y) obtain traveltime between two geolocations
    //Stay(y)=60min

if( P(x,y)>Threshold && SimulateTime<Te)//TP(u,x,y)=

   (User preference+Location Popularity)*sgn[Te-SimulateTime]/1+[1-Ps(x,y)*log(Dis(x,y)]

{
y.t=SimulateTime;
//Add point y LatLng to be transmitted in MapsRoute activity (using Shared Preferences)
//Add point y to path tree
}
}
}