Skip to content

Instantly share code, notes, and snippets.

@Yurlov
Created June 17, 2016 11:54
Show Gist options
  • Save Yurlov/8c62080c402803733b0b0c0282771d13 to your computer and use it in GitHub Desktop.
Save Yurlov/8c62080c402803733b0b0c0282771d13 to your computer and use it in GitHub Desktop.
Prog.kiev.ua
import java.util.Arrays;
public class SequenceArrayCreator{
public static void main(String[] args) {
createSequenceArray(5);
System.out.println(Arrays.toString(createSequenceArray(5)));
}
private static int[] createSequenceArray(int size) {
if(size<0){
throw new IllegalArgumentException("Sorry");
}
int[] array = new int[size];
for (int i = 0; i <=array.length-1; i++) {
array[i]=i;
}
return array;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment