def to_java_array(ls, java_type, gateway_client):
    """
    Convert python iterable into a java array
    :param ls:
    :param java_type:
    :param gateway_client:
    :return:
    """
    arr = gateway_client.new_array(java_type, len(ls))
    for i in range(0, len(ls)):
        arr[i] = ls[i]
    return arr