I recommend using a List instead of an array for this operation, assuming you don't already know the number of entries that will be recorded from the file as input.

import java.io.BufferedReader;...