### Question:
SrtmService { public int getElevation(double lon, double lat) { int key = (((int)lat) + 90) * 360 + (((int)lon) + 180); SrtmTile srtmTile = tileMap.get(key); return srtmTile.getElevation(lon, lat); }  void scanDirectory(String directory); void insertElevation(Iterable<Elevationable> iterable); int getElevation(double lon, double lat);  }### Answer:
@Test @Ignore public void testGetElevation() throws Exception { GpxType gpxType = fromStream(SrtmServiceTest.class.getResourceAsStream("/relation_49176.gpx")); SrtmService srtmService = new SrtmService(); srtmService.scanDirectory("\\\\alpha\\Data\\data\\srtm\\dds.cr.usgs.gov\\srtm\\version2_1\\SRTM3\\Eurasia"); List<WptType> trkpt = gpxType.getTrk().get(0).getTrkseg().get(0).getTrkpt(); double length = 0; double asc = 0; double desc = 0; WptType lastPoint = trkpt.get(0); DecimalFormat df = new DecimalFormat("0.00"); long time = System.currentTimeMillis(); int lastEle = -1; for (WptType wptType : trkpt) { int elevation = srtmService.getElevation(wptType.getLon().doubleValue(), wptType.getLat().doubleValue()); if (lastEle != -1) { int diff = lastEle - elevation; if (Math.abs(diff) > 10) { if (diff > 0) asc += diff; else desc += diff; lastEle = elevation; } } else lastEle = elevation; double distance = LonLatMath.distance(lastPoint.getLon().doubleValue(), lastPoint.getLat().doubleValue(), wptType.getLon().doubleValue(), wptType.getLat().doubleValue()); length += distance; System.out.println(df.format(length) + "\t" + elevation); lastPoint = wptType; } System.out.println("Asc:" + asc + " Desc: " + desc); }