### Question:
WebHelper { public static PointList decodePolyline(String encoded, int initCap, boolean is3D) { PointList poly = new PointList(initCap, is3D); int index = 0; int len = encoded.length(); int lat = 0, lng = 0, ele = 0; while (index < len) { int b, shift = 0, result = 0; do { b = encoded.charAt(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int deltaLatitude = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lat += deltaLatitude; shift = 0; result = 0; do { b = encoded.charAt(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int deltaLongitude = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lng += deltaLongitude; if (is3D) { shift = 0; result = 0; do { b = encoded.charAt(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int deltaElevation = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); ele += deltaElevation; poly.add((double) lat / 1e5, (double) lng / 1e5, (double) ele / 100); } else poly.add((double) lat / 1e5, (double) lng / 1e5); } return poly; }  static String encodeURL(String str); static PointList decodePolyline(String encoded, int initCap, boolean is3D); static String encodePolyline(PointList poly); static String encodePolyline(PointList poly, boolean includeElevation); static String readString(InputStream inputStream);  }### Answer:
@Test public void testDecode() throws Exception { PointList list = WebHelper.decodePolyline("_p~iF~ps|U", 1, false); assertEquals(Helper.createPointList(38.5, -120.2), list); list = WebHelper.decodePolyline("_p~iF~ps|U_ulLnnqC_mqNvxq`@", 3, false); assertEquals(Helper.createPointList(38.5, -120.2, 40.7, -120.95, 43.252, -126.453), list); }
@Test public void testDecode3D() throws Exception { PointList list = WebHelper.decodePolyline("_p~iF~ps|Uo}@", 1, true); assertEquals(Helper.createPointList3D(38.5, -120.2, 10), list); list = WebHelper.decodePolyline("_p~iF~ps|Uo}@_ulLnnqC_anF_mqNvxq`@?", 3, true); assertEquals(Helper.createPointList3D(38.5, -120.2, 10, 40.7, -120.95, 1234, 43.252, -126.453, 1234), list); }