First of all, I think there's a problem with this :
I don't think your index will never reach 20 cause an array index start from 0 not from 1.
As Norm said, it will be better if we see your output.
Meanwhile, I just write a small example of what you want to do :
import java.util.Arrays;
import java.util.Scanner;
public class Test {
static int numArray[] = new int[10];
static int sum=0;
static double avg=0;
static int median=0;
public static void main(String args[]) {
//filling the array
for(int i=0 ; i<numArray.length ; i++){
System.out.print("Enter a number : ");
Scanner scan = new Scanner(System.in);
numArray[i] = scan.nextInt();
}
//calculating the sum
for(int num : numArray){
sum +=num;
}
System.out.println(sum);
//calculating the average
avg = (double)sum/numArray.length;
System.out.println(avg);
//calculating the median
Arrays.sort(numArray);//we sort the numArray
median = numArray[4];//!\the first element of an array is at the index 0.
System.out.println(median);
}
I tested it and it works.
Hope it can help you...