question: public static String encode ( final List < Position > path , int precision ) { long lastLat = 0 ; long lastLng = 0 ; final StringBuffer result = new StringBuffer ( ) ; double factor = Math . pow ( 10 , precision ) ; for ( final Position point : path ) { long lat = Math . round ( point . getLatitude ( ) * factor ) ; long lng = Math . round ( point . getLongitude ( ) * factor ) ; long dLat = lat - lastLat ; long dLng = lng - lastLng ; encode ( dLat , result ) ; encode ( dLng , result ) ; lastLat = lat ; lastLng = lng ; } return result . toString ( ) ; }
target:  Encodes a sequence of Positions into an encoded path string.