code: @NonNull
    public static String encode(@NonNull final List<Point> path, int precision) {
      long lastLat = 0;
      long lastLng = 0;
  
      final StringBuilder result = new StringBuilder();
  
      // OSRM uses precision=6, the default Polyline spec divides by 1E5, capping at precision=5
      double factor = Math.pow(10, precision);
  
      for (final Point point : path) {
        long lat = Math.round(point.latitude() * factor);
        long lng = Math.round(point.longitude() * factor);
  
        long varLat = lat - lastLat;
        long varLng = lng - lastLng;
  
        encode(varLat, result);
        encode(varLng, result);
  
        lastLat = lat;
        lastLng = lng;
      }
      return result.toString();
    }
docs: Encodes a sequence of Points into an encoded path string.
  
  @param path      list of {@link Point}s making up the line
  @param precision OSRMv4 uses 6, OSRMv5 and Google uses 5
  @return a String representing a path string
  @since 1.0.0