private static String shortestParam(LatLng[] points) {
    String joined = join('|', points);
    String encoded = "enc:" + PolylineEncoding.encode(points);
    return joined.length() < encoded.length() ? joined : encoded;
  }
Chooses the shortest param (only a guess, since the length is different after URL encoding).
src/main/java/com/google/maps/ElevationApi.java