I was wondering if in Java there is a function like the python range function.
range(4)
and it would return
[0,1,2,3]
As far as I know, there's not an equivalent function in java. But you can write it yourself:
public static int[] range(int n) { int[] ans = new int[n]; int i; for(i = 0; i < n; i++) { ans[i] = i; } return ans; }