public static boolean isValidLocation(double lon,double lat){
  return Math.abs(lat) <= 90 && Math.abs(lon) <= 180;
}

public static boolean isValidLocation ( double lon , double lat ) { return Math . abs ( lat ) <= 90 && Math . abs ( lon ) <= 180 ; }
checks if a given location is a valid ( i . e . physically possible ) location on earth . note : the special separator locations ( which have latitude = 100 ) will not qualify as valid . neither will locations with lat = 0 and lng = 0 as these are most likely " bad " measurements which often cause trouble .
