if (elements.getClass().getComponentType() != ScriptRuntime.ObjectClass) throw new IllegalArgumentException(); NativeArray result = new NativeArray(elements);
NativeArray result = new NativeArray(length);
    public final Scriptable newArray(Scriptable scope, Object[] elements)    {        if (elements.getClass().getComponentType() != ScriptRuntime.ObjectClass)            throw new IllegalArgumentException();        NativeArray result = new NativeArray(elements);        ScriptRuntime.setObjectProtoAndParent(result, scope);        return result;    }