tags:

views:

22

answers:

0

Possible Duplicate:
Read input as array

Hi

i want to make something read from inputstream to store in array int[] inputInts when i type "read 1 2 3 4", what should i do?

i do not know the size of the array, everything is dynamic...

here is the current codes

BufferedReader stdin = new BufferedReader(
new InputStreamReader(System.in));
String line = stdin.readLine();
StringTokenizer st = new StringTokenizer(line);
String command = st.nextToken();

if (command.equals("read")) {
   while(st.nextToken()!=null){
       //my problem is no sure the array size

   }
}