Solution 1
List<String[]> arrays = new ArrayList<String[]>(); //You need an array list of arrays since you dont know how many lines does the text file has
try {
BufferedReader in = new BufferedReader(new FileReader("infilename"));
String str;
while ((str = in.readLine()) != null) {
String arr[] = str.split(" ");
if(arr.length>0) arrays.add(arr);
}
in.close();
} catch (IOException e) {
}
At the end arrays will contain every array. In your example arrays.length()==4
To iterate over the arrays:
for( String[] myarr : arrays){
//Do something with myarr
}
Solution 2: I don't think this is a good idea but if you are sure the file always is going to contain 4 lines you can do this
String arr1[];
String arr2[];
String arr3[];
String arr4[];
try {
BufferedReader in = new BufferedReader(new FileReader("infilename"));
String str;
str = in.readLine();
arr1[] = str.split(" ");
str = in.readLine();
arr2[] = str.split(" ");
str = in.readLine();
arr3[] = str.split(" ");
str = in.readLine();
arr4[] = str.split(" ");
in.close();
} catch (IOException e) {
}