It's pretty simple:
totalIndex
counts each line you read,
totalOdd
counts the number of odd numbers you find.
And then you print the odd numbers using the wrong number:
System.out.print("Odd numbers are: ");
for (int i = 0; i < totalIndex; i++) {
System.out.print(oddNumbers[i] + " ");
}
Change
totalIndex
to
totalOdd
and your spurious zeros will vanish.
And your mean? That's integer division for you!
Your sum is -3 + 2 + 0 + 0 + 1 - 5 == -5, and the number of elements is 6. In integer division, -5 / 6 is 0.
Change your sum to a double and it should work.