tags:

views:

71

answers:

4
+3  A: 

Are you sure that your array is not integer ?

if it's, try using double.

Ahmet Kakıcı
+2  A: 

I'm assuming that aray is an int[] and sum is an int. In this case, Java will perform integer division, which results in 0 in this case.

VeeArr
+1  A: 

Others noted the cause. To fix, (double) aray[j]/sum.

Nikita Rybak
A: 

Dividing integers will get you an integer answer rounded down to the first whole number. If you want a decimal result, you have to make it 21.0/100.0.

edl