Not sure if it's the way I organized my code or...? But, any help will be greatly appreciated!

package com.codegym.task.task05.task0507;
/*
Arithmetic mean
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int sum = 0;
int count = 0;
while (true) {
int num = Integer.parseInt(br.readLine());
if (num != -1) {
sum += num;
count++;
}
if (num == -1) {
break;
}
}
double mean = sum/count;
System.out.println(mean);
}
}