code: def to_j_explain_detail_arr(p_extra_details):
      # sphinx will check "import loop" when generating doc,
      # use local import to avoid above error
      from pyflink.table.explain_detail import ExplainDetail
  
      gateway = get_gateway()
  
      def to_j_explain_detail(p_extra_detail):
          if p_extra_detail == ExplainDetail.JSON_EXECUTION_PLAN:
              return (
                  gateway.jvm.org.apache.flink.table.api.ExplainDetail.JSON_EXECUTION_PLAN
              )
          elif p_extra_detail == ExplainDetail.CHANGELOG_MODE:
              return (
                  gateway.jvm.org.apache.flink.table.api.ExplainDetail.CHANGELOG_MODE
              )
          elif p_extra_detail == ExplainDetail.ESTIMATED_COST:
              return (
                  gateway.jvm.org.apache.flink.table.api.ExplainDetail.ESTIMATED_COST
              )
          else:
              return (
                  gateway.jvm.org.apache.flink.table.api.ExplainDetail.PLAN_ADVICE
              )
  
      _len = len(p_extra_details) if p_extra_details else 0
      j_arr = gateway.new_array(
          gateway.jvm.org.apache.flink.table.api.ExplainDetail, _len
      )
      for i in range(0, _len):
          j_arr[i] = to_j_explain_detail(p_extra_details[i])
  
      return j_arr
  
file_path: flink/flink-python/pyflink/util/java_utils.py
imports: from datetime import timedelta
  from py4j.java_gateway import JavaClass, get_java_class, JavaObject
  from py4j.protocol import Py4JJavaError
  from pyflink.java_gateway import get_gateway
label_desc: Use image node_id 12 for calling a global function with example usage: to_j_explain_detail_arr(p_extra_details) and returns: j_arr, gateway, gateway, gateway, gateway