Here you can find the source of range(int end)
public static int[] range(int end)
//package com.java2s; //License from project: Open Source License public class Main { public static int[] range(int end) { assert end > 0; int[] ary = new int[end]; for (int i = 0; i < end; ++i) { ary[i] = i;/*from w w w . j a v a 2 s. c o m*/ } return ary; } public static int[] range(int start, int end) { int l = end - start; assert l > 0; int[] ary = new int[l]; for (int i = 0; i < l; ++i) { ary[i] = i + start; } return ary; } }