Are you sure that your array is not integer ?
if it's, try using double.
Ahmet Kakıcı
2010-06-10 17:57:08
Are you sure that your array is not integer ?
if it's, try using double.
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.
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.