import java.io.*;
import java.util.StringTokenizer;
public class Project1 {
public static void createArrays(){
int[] nums = null;
try {
File file1 = new File("file1.txt");
FileReader fileReader = new FileReader(file1);
BufferedReader reader = new BufferedReader(fileReader);
String line = null;
while ((line = reader.readLine()) != null){
StringTokenizer st = new StringTokenizer (line);
nums = new int[st.countTokens()];
//System.out.println(line);
int i=0;
while (st.hasMoreTokens()){
String token = st.nextToken();
nums[i] = Integer.parseInt(token);
i++;
}
System.out.print("[");
for(int j=0;j<i;j++){
System.out.print(" "+nums[j]+" ");
}
System.out.println("]");
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String [] args){
createArrays();
}
}
i feel this code will help you to move further.