There are a few problems with your code. As has been mentioned in the comments, you're not checking for array bounding and you're reading character by character. You may want to look into the BufferedReader class. It allows you to read an entire line in one go. You also may want to look into the parse() method of the various primitive types. The Number class has a parse method, and thus so do the Double, Integer, Long, Short, etc classes. Last, check out the java.util package. It has a lot of usefully collections such as lists, dictionaries (called Maps), and other things.
Here's some code that demonstrates all of the above to solve the problem you're having.
String line = null;
ArrayList<integer> numbers = new ArrayList<>();
try(BufferedReader reader = new BufferedReader(new FileReader("someFilePath"))){
while((line = reader.readLine()) != null){
String[] ints = line.split(" ");
for(String number : ints){
try{
Integer i = Integer.parse(number);
numbers.add(i);
}
catch(NumberFormatException ex){
continue;
}
}
}
}
catch(IOException ex){
}