14 9.4.2.3 ArraySpeciesCreate(originalArray, length)                                                 // 15
491277
function(original, length){                                                                // 16
  var C;                                                                                             // 17
  if(isArray(original) && isObject(C = original.constructor)){                                       // 18
    C = C[SPECIES];                                                                                  // 19
    if(C === null)C = undefined;                                                                     // 20
  } return new(C === undefined ? Array : C)(length);                                                 // 21
}
590693
protected void initSpecialArrays() {
        int len = getByteArray().length;
        // set up the "status code + SPACE + default reason phrase"
        this.bytesWithPhrase = new byte[len + 1 + this.myPhraseBytes.length];
        System.arraycopy(getByteArray(), 0, this.bytesWithPhrase, 0, len);
        this.bytesWithPhrase[len] = BNFHeaders.SPACE;
        System.arraycopy(this.myPhraseBytes, 0, this.bytesWithPhrase, len + 1, this.myPhraseBytes.length);
    }
1315777
function extend(inarr, newlen) {
  //--byte newarr[];
  var newarr;
  if (inarr.length==newlen)
   return inarr;
  newarr=createArrayWithZeros(newlen);
  //--java.lang.System.arraycopy((java.lang.Object)inarr,0,(java.lang.Object)newarr,0,inarr.length);
  this.arraycopy(inarr,0,newarr,0,inarr.length);
  // 0 padding is carried out by the JVM on allocation initialization
  return newarr;
  }
333660
def new_array(state, element_type, size, default_value_generator=None):
        
        size_bounded = SimSootExpr_NewMultiArray._bound_multi_array_size(state, size)
        # return the reference of the array base
        # => elements getting lazy initialized in the javavm memory
        return SimSootValue_ArrayBaseRef(heap_alloc_id=state.javavm_memory.get_new_uuid(),
                                         element_type=element_type,
                                         size=size_bounded,
                                         default_value_generator=default_value_generator)
1092829
function create() {
  var out = new glMatrix.ARRAY_TYPE(9);
  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
    out[5] = 0;
    out[6] = 0;
    out[7] = 0;
  }
  out[0] = 1;
  out[4] = 1;
  out[8] = 1;
  return out;
}
3380
function ArrayType(attrs, opts) {
  Type.call(this);

  if (!attrs.items) {
    throw new Error(f('missing array items: %j', attrs));
  }
  this._items = createType(attrs.items, opts);
}
779415
@Override
    public Array createArrayOf(String typeName, Object[] elements) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
526085
function( array, type, forceClone ) {

		if ( ! array || // let 'undefined' and 'null' pass
				! forceClone && array.constructor === type ) return array;

		if ( typeof type.BYTES_PER_ELEMENT === 'number' ) {

			return new type( array ); // create typed array

		}

		return Array.prototype.slice.call( array ); // create Array

	}
802022
function ArrayField (array, name, parent) {
  if (!(this instanceof ArrayField)) return new ArrayField(array, name, parent);
  debug('array <%s> being built', name);
  Entry.call(this, array, name, parent);
  this._context = parent._context;
  this._this = parent._this;
  this._currVal = {};

  var data = this._content;
  this._config = {
    size: function () { return 1; }
  };
  if (this._content.length > 0 &&
      this._content[0] === '{{_$config}}') {
    data = this._content.slice(2);
    debug('array <%s> is configured with options <%s>', name, this._content[1]);
    var opts = _.defaults(this._content[1], DEFAULTS);
    if (Array.isArray(opts.size)) {
      this._config.size = function () {
        return _.random(opts.size[0], opts.size[1]);
      };
    } else {
      this._config.size = function () {
        return Number(opts.size);
      };
    }
  }
  this._children = [];
  data.forEach(function (child, index) {
    this._children.push(helpers.build(child, index, this));
    (function (method) {
      var child = this._children[method];
      Object.defineProperty(this._currVal, method, {
        enumerable: true,
        get: function () {
          if (child._currVal === undefined)
            return child.next();
          return child._currVal; // doc and array's currval never empty
        }
      });
    }).call(this, index);
  }, this);

  debug('array <%s> build complete', name);
}
881674
@SuppressWarnings("unchecked")
    public static <T> T[] newArrayInstance(T[] template, int length) {
        return newArrayInstance((Class<T>) template.getClass().getComponentType(), length);
    }
1223310
ArrayCreationExpr juggleArrayCreation(TokenRange range, List<TokenRange> levelRanges, Type type, NodeList<Expression> dimensions, List<NodeList<AnnotationExpr>> arrayAnnotations, ArrayInitializerExpr arrayInitializerExpr) {
        NodeList<ArrayCreationLevel> levels = new NodeList<>();

        for (int i = 0; i < arrayAnnotations.size(); i++) {
            levels.add(new ArrayCreationLevel(levelRanges.get(i), dimensions.get(i), arrayAnnotations.get(i)));
        }
        return new ArrayCreationExpr(range, type, levels, arrayInitializerExpr);
    }
1186146
private static int[] createIntArray(int size, int initialValue)
    {
        int[] array = new int[size];

        for (int i = 0; i < size; ++i)
        {
            array[i] = initialValue;
        }

        return array;
    }
67323
function getLengthOfCombinedArrays(name) {
    let length = 0;
    let arraySpec;
    for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
      const arrays = arrayOfArrays[ii];
      const arrayInfo = arrays[name];
      const array = getArray(arrayInfo);
      length += array.length;
      if (!arraySpec || arrayInfo.data) {
        arraySpec = arrayInfo;
      }
    }
    return {
      length: length,
      spec: arraySpec,
    };
  }
783153
function generate_simple_array (type, length) {
	type = method.get(type) ? method.get(type).key : default_config.type;
	length = parseInt(length, 10) || default_config.length;
	assert.number(length, 'Array length must be a number');
	return gen[type](length);
}
208076
function createOutput( $arr, $oldArray, $newArray )
    {
        $diff = array();

        foreach( $arr as $item )
        {
            $old = null;
            $new = null;
            foreach ( $item as $par => $state )
            {
                switch ( $state )
                {
                    case 'unchanged':
                    {
                        $index = $par;
                    }break;

                    case 'changed':
                    {
                        $old = $oldArray[$par];
                        $new = $newArray[$par];
                    }break;

                    case 'added':
                    {
                        $new = $newArray[$par];
                    }break;

                    case 'removed':
                    {
                        $old = $oldArray[$par];
                    }break;
                }
            }

            if ( $old === null )
            {
                if ( $new === null )
                {
                    // unchanged paragraph
                    $text = $newArray[$index];
                    $this->addNewLine( $text );
                    $diff[] = array( 'unchanged' => $text,
                                     'status' => 0 );
                }
                else
                {
                    // added paragraph
                    $text = $new;
                    $this->addNewLine( $text );
                    $diff[] = array( 'added' => $text,
                                     'status' => 2 );
                }
            }
            elseif ( $new === null )
            {
                // removed paragraph
                $text = $old;
                $this->addNewLine( $text );
                $diff[] = array( 'removed' => $text,
                                 'status' => 1 );
            }
            else
            {
                // changed paragraph
                $diffText = $this->buildDiff( explode( ' ', $old ), explode( ' ', $new ) );
                $size = count( $diffText ) - 1;

                foreach( $diffText as $number => $change )
                {
                    $state = $change['status'];
                    switch( $state )
                    {
                        case '0':
                        {
                            if ( $number == $size )
                                $this->addNewLine( $change['unchanged'] );
                        }break;

                        case '1':
                        {
                            if ( $number == $size )
                                $this->addNewLine( $change['removed'] );
                        }break;

                        case '2':
                        {
                            if ( $number == $size )
                                $this->addNewLine( $change['added'] );
                        }break;
                    }
                    $diff[] = $change;
                }
            }
        }
        $output = $this->postProcessDiff( $diff );
        return $output;
    }
462113
function arraySafeConcat(arr, arg) {
  var result = arrayClone(arr), len = result.length, arr2;
  arr2 = isArray(arg) ? arg : [arg];
  result.length += arr2.length;
  forEach(arr2, function(el, i) {
    result[len + i] = el;
  });
  return result;
}
1187331
function(s) {
                //TODO: validate array length
		//TODO: return unwanted subset as new Px object

                var counts = this.valCounts(),
                multipliers = [];

                _.each(s, function(d, i) {
                    if (d[0] === '*') {
                        s[i] = _.range(0, counts[i] - 1);
                    }
                });

                for (var i = 0, l = counts.length; i < l - 1; i++) {
                    multipliers[i] = _.reduce(counts.slice(i+1), function(a, b) { return a * b; });
                }
                multipliers.push(1);

                for (var j = 0, k = s.length; j < k; j++) {
                    
                    // drop the values
                    this.metadata.VALUES[this.variables()[j]] = 
                        _.filter(this.metadata.VALUES[this.variables()[j]], function(e, m) {
                            return _.indexOf(s[j], m) !== -1;
                        });
                }

                var keepIdxs = [];
                var pattern = function pattern(c,m,w,p) {
                    if (c.length > 1) {
                        p = typeof p !== 'undefined' ? p : 1;
                        var count = c.pop(),
                            multiple = m.pop(),
                            want = w.pop();

                        var patt = _.flatten(_.map(_.range(0, count), function(d) { 
                            return _.include(want, d) ? p : _arrayOfZeroes(multiple);
                        }));

                        pattern(c, m, w, patt);
                    }
                    keepIdxs.push(_.flatten(p));
                };
                pattern(counts,multipliers,s);
                keepIdxs = keepIdxs[0];

                var indices = [];
                _.each(s[0], function(d) {
                    var start = d * multipliers[0];
                    var end = start + multipliers[0];
                    indices.push(_.filter(_.range(start, end), function(d, i) {return keepIdxs[i] === 1;}));
                });
                indices = _.flatten(indices);
                this.data = _.filter(this.data, function(d, i) {return _.indexOf(indices, i) !== -1;});
            }