Here you can find the source of range(int n)
public static int[] range(int n)
//package com.java2s; //License from project: BSD License public class Main { public static int[] range(int n) { int[] result = new int[n]; for (int i = 0; i < n; i++) { result[i] = i;//from ww w.jav a 2s .c om } return result; } }