|
Re: Number in Java
Consider that the number of elements in the array will be abs(first-last) + 1.
I will try to keep this fairly vague since it seems you want to solve this problem yourself. For the loop, I would suggest using two variables as counters: one as an index into the array from 0 to the number of elements in the array - 1; and another for counting from the first to the last number in the set. (There are, as always, numerous ways to achieve the same goal.)
As for allowing user input in the format a...b, you could use StringTokenizer or Pattern and Matcher for regular expression matching.
|