1Just some minor modification to your code will do (with some var renaming for clarity) :
2
3double sum = 0; //average will have decimal point
4
5for(int i=0; i < args.length; i++){
6 //parse string to double, note that this might fail if you encounter a non-numeric string
7 //Note that we could also do Integer.valueOf( args[i] ) but this is more flexible
8 sum += Double.valueOf( args[i] );
9}
10
11double average = sum/args.length;
12
13System.out.println(average );