25 List<Coordinate> coordinates =
new ArrayList<Coordinate>();
26 int index = 0, shift, result;
28 int lat = 0, lng = 0, latitude_change, longitude_change,
29 factor = (int) Math.pow(10, precision);
31 while (index < polyline.length()) {
37 byte_ = polyline.charAt(index++) - 63;
38 result |= (byte_ & 0x1f) << shift;
40 }
while (byte_ >= 0x20);
42 latitude_change = ((result % 2 == 1) ? ~(result >> 1) : (result >> 1));
47 byte_ = polyline.charAt(index++) - 63;
48 result |= (byte_ & 0x1f) << shift;
50 }
while (byte_ >= 0x20);
52 longitude_change = ((result % 2 == 1) ? ~(result >> 1) : (result >> 1));
54 lat += latitude_change;
55 lng += longitude_change;
57 coordinates.add(
new Coordinate((
double)lat / factor,(
double)lng / factor));