public static CoordinateSequence decode(final String encodedPath){
  int len=encodedPath.length();
  final List<Coordinate> path=new ArrayList<>();
  int index=0;
  int lat=0;
  int lng=0;
  while (index < len) {
    int result=1;
    int shift=0;
    int b;
    do {
      b=encodedPath.charAt(index++) - 63 - 1;
      result+=b << shift;
      shift+=5;
    }
 while (b >= 0x1f);
    lat+=(result & 1) != 0 ? ~(result >> 1) : (result >> 1);
    result=1;
    shift=0;
    do {
      b=encodedPath.charAt(index++) - 63 - 1;
      result+=b << shift;
      shift+=5;
    }
 while (b >= 0x1f);
    lng+=(result & 1) != 0 ? ~(result >> 1) : (result >> 1);
    path.add(new Coordinate(lng * 1e-5,lat * 1e-5));
  }
  return new PackedCoordinateSequence.Double(path.toArray(new Coordinate[path.size()]));
}

public static CoordinateSequence decode ( final String encodedPath ) { int len = encodedPath . length ( ) ; final List < Coordinate > path = new ArrayList < > ( ) ; int index = 0 ; int lat = 0 ; int lng = 0 ; while ( index < len ) { int result = 1 ; int shift = 0 ; int b ; do { b = encodedPath . charAt ( index ++ ) - 63 - 1 ; result += b << shift ; shift += 5 ; } while ( b >= 0x1f ) ; lat += ( result & 1 ) != 0 ? ~ ( result > > 1 ) : ( result > > 1 ) ; result = 1 ; shift = 0 ; do { b = encodedPath . charAt ( index ++ ) - 63 - 1 ; result += b << shift ; shift += 5 ; } while ( b >= 0x1f ) ; lng += ( result & 1 ) != 0 ? ~ ( result > > 1 ) : ( result > > 1 ) ; path . add ( new Coordinate ( lng * 1e-5 , lat * 1e-5 ) ) ; } return new PackedCoordinateSequence . Double ( path . toArray ( new Coordinate [ path . size ( ) ] ) ) ; }
decodes an encoded path string into a sequence of latlngs .
