I\'m asking the user to enter some numbers between 1 and 100 and assign them into an array. The array size is not initialized since it is dependent on the number of times the us
String line=sc.nextLine();
int counter=1;
for(int i=0;i=line.length() || line.charAt(j)==' ') {
break;
}
j++;
}
numbers[counter]=Integer.parseInt(line.substring(i,j));
i=j;
counter++;
}
for(int i=0;i
I always use this code for situations like this. beside you can recognize two or three or more digit numbers.