code: public JSONArray toJSONArray(JSONArray names) throws JSONException {
          if (names == null || names.isEmpty()) {
              return null;
          }
          JSONArray ja = new JSONArray();
          for (int i = 0; i < names.length(); i += 1) {
              ja.put(this.opt(names.getString(i)));
          }
          return ja;
      }
docs: Produce a JSONArray containing the values of the members of this
  JSONObject.
  
  @param names
  A JSONArray containing a list of key strings. This determines
  the sequence of the values in the result.
  @return A JSONArray of values.
  @throws JSONException
  If any of the values are non-finite numbers.