private static void encode(long v, StringBuilder result) {
    v = v < 0 ? ~(v << 1) : v << 1;
    while (v >= 0x20) {
      result.append(Character.toChars((int) ((0x20 | (v & 0x1f)) + 63)));
      v >>= 5;
    }
    result.append(Character.toChars((int) (v + 63)));
  }
Encodes a sequence of LatLngs into an encoded path string.
src/main/java/com/google/maps/internal/PolylineEncoding.java