Java Array Fill fillArray(int min, int max)

Here you can find the source of fillArray(int min, int max)

Description

Create a filled array with values going from min to max-1 (i.e.

License

Open Source License

Parameter

Parameter Description
min a parameter
max a parameter

Declaration

public static int[] fillArray(int min, int max) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Open Door Logistics (www.opendoorlogistics.com)
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v3
 * which accompanies this distribution, and is available at http://www.gnu.org/licenses/lgpl.txt
 ******************************************************************************/

public class Main {
    /**/*www. j  av a 2  s. c om*/
     * Create a filled array with values going from min to max-1
     * (i.e. min is inclusive but max is exclusive).
     * @param min
     * @param max
     * @return
     */
    public static int[] fillArray(int min, int max) {
        int nb = max - min;
        int[] ret = new int[nb];
        for (int i = 0; i < nb; i++) {
            ret[i] = min + i;
        }
        return ret;
    }
}

Related

  1. fillArray(double[][][] array, double[] value, int rows, int columns)
  2. fillArray(final float[] array, final float value)
  3. fillArray(float filling, int length)
  4. fillArray(float[] batchVertices, float f)
  5. fillArray(int arrayLength)
  6. fillArray(int size, Float value)
  7. fillArray(int value, int length)
  8. fillArray(int[] array, int value)
  9. fillArray(int[] nums)