Java Number Range Create range(final int max)

Here you can find the source of range(final int max)

Description

Helper function that generates an array of the numbers 0..max-1.

License

Apache License

Parameter

Parameter Description
max the size of the array.

Return

an array of the numbers 0..max-1.

Declaration

public static int[] range(final int max) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//ww  w  . j  av  a 2 s .c  o m
     * Helper function that generates an array of the numbers 0..max-1.
     * 
     * @param max the size of the array.
     * @return an array of the numbers 0..max-1.
     */
    public static int[] range(final int max) {
        int[] ret = new int[max];
        for (int i = 0; i < max; ++i) {
            ret[i] = i;
        }
        return ret;
    }
}

Related

  1. range(double a, double b, double step)
  2. range(double value1, double value2)
  3. range(double[] data, int to, int stride, int numElementsEachStride)
  4. range(double[] min, double[] max, double[] min2, double[] max2)
  5. range(double[] vals)
  6. range(float number, float value, float range)
  7. range(int begin, int end)
  8. range(int end)
  9. range(int excludedEnd)