public static String encode(final Coordinate[] coords){
  long lastLat=0;
  long lastLng=0;
  final StringBuffer result=new StringBuffer();
  for (  final Coordinate point : coords) {
    long lat=Math.round(point.y * 1e5);
    long lng=Math.round(point.x * 1e5);
    long dLat=lat - lastLat;
    long dLng=lng - lastLng;
    encode(dLat,result);
    encode(dLng,result);
    lastLat=lat;
    lastLng=lng;
  }
  return result.toString();
}

public static String encode ( final Coordinate [ ] coords ) { long lastLat = 0 ; long lastLng = 0 ; final StringBuffer result = new StringBuffer ( ) ; for ( final Coordinate point : coords ) { long lat = Math . round ( point . y * 1e5 ) ; long lng = Math . round ( point . x * 1e5 ) ; long dLat = lat - lastLat ; long dLng = lng - lastLng ; encode ( dLat , result ) ; encode ( dLng , result ) ; lastLat = lat ; lastLng = lng ; } return result . toString ( ) ; }
encodes a sequence of latlngs into an encoded path string .
