| | |
| | | String queryResult = getResponse(queryUrl); |
| | | JSONObject job = JSONObject.parseObject(queryResult); |
| | | JSONArray ja = job.getJSONArray("results"); |
| | | if (ja.size() == 0){ |
| | | return 0.00 + ""; |
| | | } |
| | | JSONObject jobO = JSONObject.parseObject(ja.getString(0)); |
| | | result = Long.parseLong(jobO.get("distance").toString()); |
| | | double kilDis = (double) result / 1000; |
| | | DecimalFormat decimalFormat = new DecimalFormat("#.00"); |
| | | return decimalFormat.format(kilDis); |
| | | double demo = result / 1000; |
| | | return decimalFormat.format(demo); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(); |
| | | } |