Why would you need an array just have

int count = 0;
int sum = 0;
while(file.hasNext()) {
sum+= (int)(Integer.parseInt(fileScan.nextLine());
count++;
}