Your data types are all wrong. Don't just use the smallest data type just because your value will fit in it. The types 'int' and 'double' tend to be the most efficient because they map closer to today's hardware instruction set and require less implicit conversions. So, no 'byte' and no 'float'. There are special circumstances in which these are appropriate, but yours is not one of them.
Dividing an integer will get you into trouble: 1 / 2 is zero, not 0.5 because the result is an integer as well and '2' goes into '1' zero times. For your algorithm you'll probably want to use doubles for most, if not all, of your parameters, in order to preserve the fractional component.