### Question:
JSONArray extends JSONElement implements Iterable<Object> { public String join(String token) throws JSONException { return StreamSupport.stream(obj.spliterator(), false) .map(String::valueOf) .collect(Collectors.joining(token)); } JSONArray();  JSONArray(String jsonString);  JSONArray(Collection<?> collection);  JSONArray(Object array);   JSONArray(JsonArray array);   JSONArray(JsonElement jsonElement); int length(); JSONArray put(JSONObject object); JSONArray put(JSONArray array); JSONArray put(double num); JSONArray put(int num); JSONArray put(long num); JSONArray put(float num); JSONArray put(Number num); JSONArray put(boolean bool); JSONArray put(String str); JSONArray put(Map map); JSONArray put(Collection collection); JSONArray put(T enumValue); JSONArray put(int index, long number); JSONArray put(int index, double number); JSONArray put(int index, boolean bool); JSONArray put(int index, Object object); JSONArray put(int index, float number); JSONArray put(int index, int number); JSONArray put(int index, Number number); JSONArray put(int index, String string); JSONArray put(int index, Map map); JSONArray put(int index, Collection collection); JSONArray put(int index, T enumValue); JSONArray put(Object object); Object remove(int index); boolean getBoolean(int index); boolean optBoolean(int index); boolean optBoolean(int index, boolean defaultValue); JSONObject getJSONObject(int index); JSONObject optJSONObject(int index); double getDouble(int index); double optDouble(int index); double optDouble(int index, double defaultValue); float getFloat(int index); float optFloat(int index); float optFloat(int index, float defaultValue); long getLong(int index); long optLong(int index); long optLong(int index, long defaultValue); Number getNumber(int index); Number optNumber(int index); Number optNumber(int index, Number defaultValue); int getInt(int index); int optInt(int index); int optInt(int index, int defaultValue); BigInteger getBigInteger(int index); BigInteger optBigInteger(int index, BigInteger defaultValue); BigDecimal getBigDecimal(int index); BigDecimal optBigDecimal(int index, BigDecimal defaultValue); String getString(int index); String optString(int index); String optString(int index, String defaultValue); JSONArray getJSONArray(int index); JSONArray optJSONArray(int index); T getEnum(Class<T> enumClass, int index); T optEnum(Class<T> enumClass, int index); T optEnum(Class<T> enumClass, int index, T defaultValue); Object get(int index); Object opt(int index); @Override String toString(); String toString(int indent); String join(String token); @Override Iterator<Object> iterator(); boolean similar(Object o); List toList(); boolean isNull(int index); boolean equals(Object o); int hashCode(); JSONObject toJSONObject(JSONArray names); boolean isEmpty();  }### Answer:
@Test public void joinArray() { String str = "[33.5, 42, \"foo\", true, apple]"; JSONArray array = new JSONArray(str); assertEquals("33.5, 42, \"foo\", true, \"apple\"", array.join(", ")); }