Here you can find the source of range(int low, int high)
Parameter | Description |
---|---|
low | the lowest integer in the range |
high | the highest integer in the range |
public static int[] range(int low, int high)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from ww w.ja v a 2 s.co m*/ * @param low the lowest integer in the range * @param high the highest integer in the range * @return an array of all the values between low (inclusive) and high * (inclusive) in order */ public static int[] range(int low, int high) { if (low > high) { throw new IllegalArgumentException(); } int[] range = new int[high - low + 1]; for (int i = 0; i < range.length; i++) { range[i] = i + low; } return range; } }