Here you can find the source of range(int i, int j)
Parameter | Description |
---|---|
i | a parameter |
j | a parameter |
public static int[] range(int i, int j)
//package com.java2s; //License from project: Apache License public class Main { /**/*from www . j a v a 2 s . c om*/ * TODO: Doc * @param i * @param j * @return */ public static int[] range(int i, int j) { if (j <= i) { return new int[0]; } int n = j - i; int[] r = new int[n]; int counter = 0; for (int k = i; k < j; ++k) { r[counter++] = k; } return r; } /** * TODO: Doc * @param n * @return */ public static int[] range(int n) { return range(0, n); } }