Created
June 17, 2016 11:54
-
-
Save Yurlov/8c62080c402803733b0b0c0282771d13 to your computer and use it in GitHub Desktop.
Prog.kiev.ua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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