In the code you've provided it looks like you're trying to find the mean not the median. I've provided some code below that should help with finding the mean. To find the median you'd need to sort the array, which is a little more complicated.
The short answer is to remove the input=0 line. Assuming that data is a public variable and that sum is a function that sums that public variable your code should work.
The implementation should depend on the context, but I would recommend a static function that takes an array of doubles as the single argument.
public class Median{
public static void main(String[] args){
double numbers[] ={1.0, 2.0, 3.0};
System.out.println(median(numbers));
}
public static double median(double[]x){
double sum = 0;
for(int i=0;i<x.length;i++){
sum += x[i];
}
return sum/x.length;
}
}