Im going home in a sec but I will try and help quickly, you have your bit of code to get the first value (a) ok, and now you want to read the file all over again and put these values into an array? You could just amend your first method to do it all instead of reading the file twice..
private int[] Feldeintrag(String fileName) throws FileNotFoundException {
//Position always 0 if you want the first line in the text file
BufferedReader in = new BufferedReader(new FileReader(fileName));
String line = null;
int[] arrayToBeCreated = null;
int a = 0;
int track = 0;
try {
while((line = in.readLine()) != null) {
System.out.println("line = " + line);
if(track == 0) {
a = Integer.parseInt(line);
System.out.println("a = " + a);
arrayToBeCreated = new int[a];
} else {
arrayToBeCreated[track - 1] = Integer.valueOf(line);
}
if(track == a) {
break;
}
track ++;
}
System.out.println("size = " + arrayToBeCreated.length);
System.out.println("0 = " + arrayToBeCreated[0]);
System.out.println("1 = " + arrayToBeCreated[1]);
System.out.println("2 = " + arrayToBeCreated[2]);
} catch (IOException e) {
System.out.println("Error in reading file");
}
System.out.println("the first number of the line is: " + a);
return arrayToBeCreated;
}
I cant promise that this does exactly what you want but I have to leave work now, I know what it is like waiting for a reply on a forum though. The method should be enough to get you in the right direction.
Edit: The first shot didnt work, bah now I'm late going home! Anyway that should work.
Cheers