Java 平均方法卡住了

Java average method stuck

伙计们,这是我的代码。代码运行良好,但我没有得到正确的平均值。有人可以修复它吗?

import java.util.Scanner;
public class test {
    public static double Avg(int amt, int num) {
     int tot = 0;
     tot = tot + num;
     int average = tot/amt;
     return average;
public static void main(String[] args) {
    double average_ICT_01 = 0;
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ICT_01 = new ArrayList<Integer>();
    for (int i=0; i<3; i++) {
        int num = sc.nextInt();
        ICT_01.add(num);
    }
     int length01 = ICT_01.size();
    for (int c=0; c<3; c++) {
        int num1 = ICT_01.get(c);
        average_ICT_01 = Avg(length01,num1);
    }

    System.out.println(average_ICT_01);
}      
}

n 个数的算术平均值是它们的总和除以n。因此,计算向量中所有数字的平均值的方法应该是:

public static double avg(List<int> vec){

    //Sum all numbers
    long sum = 0;


    for(int i=0;i<vec.size();i++){
        sum = sum + vec.get(i);
    }

    //Divide by the number of numbers
    double avg = sum/vec.size();

    //Return the average
    return avg;    
}