I'm trying to program a program to compute Weighted Median, but I have a small problem I couldn't solve.
to find the Weighted Median, you have to divide each weight by the sum then compare it with 0.5 if greater means the Weighted Median found then return the corresponding x value.
here an example:

```
x = [3,4,6,10]
w = [1,2,3,5]
1/11 > 1/2 ? no
1/11+ 2/11 > 1/2 ? no
1/11+ 2/11 + 3/11 > 1/2 ? yes

```

then return the 6 as it's the corresponding for 3

here's my attempt:

```
    public static void main(String[] args) {
    int[] x = new int[] {3,4,6,10};
    int[] w = new int[] {1,2,3,5};
    int sum = Arrays.stream(w).sum();//11

    if ((w[0]/sum)>0.5){
        System.out.print("The weighted meadin is " + x[0]);
    }
    else if ((w[0]/sum)+(w[1]/sum)>0.5){
        System.out.print("The weighted meadin is " + x[1]);
    }
    else if ((w[0]/sum)+(w[1]/sum)+(w[2]/sum)>0.5){
        System.out.print("The weighted meadin is " + x[2]);
    }
    else if ((w[0]/sum)+(w[1]/sum)+(w[2]/sum)+(w[3]/sum)>0.5){
        System.out.print("The weighted meadin is " + x[3]);
    }
    else{
        System.out.print("The weighted meadin not found");
    }
}

```

this always returns last else statement.